Skip to content

Commit 0f53f03

Browse files
fix: update Files list when envelope is created
When creating an envelope in the Files app by selecting multiple PDFs, the envelope folder was created but the Files list did not refresh to show the newly created folder. This commit adds event emissions to notify the Files app: - files:node:created event for the envelope folder - files:node:updated event for the parent directory This ensures the Files list is updated immediately after envelope creation without requiring a page refresh. Signed-off-by: Vitor Mattos <[email protected]> [skip ci]
1 parent fa7b08d commit 0f53f03

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/actions/openInLibreSignAction.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { showError } from '@nextcloud/dialogs'
1010
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
1111
import axios from '@nextcloud/axios'
1212
import { generateOcsUrl } from '@nextcloud/router'
13+
import { getClient, getDefaultPropfind, getRootPath, resultToNode } from '@nextcloud/files/dav'
1314
import 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+
4464
export const action = new FileAction({
4565
id: 'open-in-libresign',
4666
displayName: () => t('libresign', 'Open in LibreSign'),

0 commit comments

Comments
 (0)