@@ -10,6 +10,7 @@ import { showError } from '@nextcloud/dialogs'
1010import { spawnDialog } from '@nextcloud/vue/functions/dialog'
1111import axios from '@nextcloud/axios'
1212import { generateOcsUrl } from '@nextcloud/router'
13+ import { getClient , getDefaultPropfind , getRootPath , resultToNode } from '@nextcloud/files/dav'
1314import EditNameDialog from '../Components/Common/EditNameDialog.vue'
1415
1516// eslint-disable-next-line import/no-unresolved
@@ -41,6 +42,25 @@ function promptEnvelopeName() {
4142 } )
4243}
4344
45+ async function emitEnvelopeNodeCreated ( envelopePath ) {
46+ const client = getClient ( )
47+ const propfindPayload = getDefaultPropfind ( )
48+ const rootPath = getRootPath ( )
49+
50+ const result = await client . stat ( `${ rootPath } ${ envelopePath } ` , {
51+ details : true ,
52+ data : propfindPayload ,
53+ } )
54+ emit ( 'files:node:created' , resultToNode ( result . data ) )
55+
56+ const parentPath = envelopePath . substring ( 0 , envelopePath . lastIndexOf ( '/' ) ) || '/'
57+ const parentResult = await client . stat ( `${ rootPath } ${ parentPath } ` , {
58+ details : true ,
59+ data : propfindPayload ,
60+ } )
61+ emit ( 'files:node:updated' , resultToNode ( parentResult . data ) )
62+ }
63+
4464export const action = new FileAction ( {
4565 id : 'open-in-libresign' ,
4666 displayName : ( ) => t ( 'libresign' , 'Open in LibreSign' ) ,
@@ -89,11 +109,13 @@ export const action = new FileAction({
89109 settings : {
90110 path : envelopePath ,
91111 } ,
92- } ) . then ( ( response ) => {
112+ } ) . then ( async ( response ) => {
93113 const envelopeData = response . data ?. ocs ?. data
94114
95115 window . OCA . Libresign . pendingEnvelope = envelopeData
96116
117+ await emitEnvelopeNodeCreated ( envelopePath )
118+
97119 window . OCA . Files . Sidebar . close ( )
98120
99121 window . OCA . Files . Sidebar . setActiveTab ( 'libresign' )
0 commit comments