From 4ddd1a7863d36595e5c3f7cae3b9164f11921a2f Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Mon, 5 Jan 2026 13:14:25 -0300 Subject: [PATCH] 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 <1079143+vitormattos@users.noreply.github.com> --- src/actions/openInLibreSignAction.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/actions/openInLibreSignAction.js b/src/actions/openInLibreSignAction.js index c891f2a27d..5cced4d31c 100644 --- a/src/actions/openInLibreSignAction.js +++ b/src/actions/openInLibreSignAction.js @@ -10,6 +10,7 @@ import { showError } from '@nextcloud/dialogs' import { spawnDialog } from '@nextcloud/vue/functions/dialog' import axios from '@nextcloud/axios' import { generateOcsUrl } from '@nextcloud/router' +import { getClient, getDefaultPropfind, getRootPath, resultToNode } from '@nextcloud/files/dav' import EditNameDialog from '../Components/Common/EditNameDialog.vue' // eslint-disable-next-line import/no-unresolved @@ -41,6 +42,25 @@ function promptEnvelopeName() { }) } +async function emitEnvelopeNodeCreated(envelopePath) { + const client = getClient() + const propfindPayload = getDefaultPropfind() + const rootPath = getRootPath() + + const result = await client.stat(`${rootPath}${envelopePath}`, { + details: true, + data: propfindPayload, + }) + emit('files:node:created', resultToNode(result.data)) + + const parentPath = envelopePath.substring(0, envelopePath.lastIndexOf('/')) || '/' + const parentResult = await client.stat(`${rootPath}${parentPath}`, { + details: true, + data: propfindPayload, + }) + emit('files:node:updated', resultToNode(parentResult.data)) +} + export const action = new FileAction({ id: 'open-in-libresign', displayName: () => t('libresign', 'Open in LibreSign'), @@ -89,11 +109,13 @@ export const action = new FileAction({ settings: { path: envelopePath, }, - }).then((response) => { + }).then(async (response) => { const envelopeData = response.data?.ocs?.data window.OCA.Libresign.pendingEnvelope = envelopeData + await emitEnvelopeNodeCreated(envelopePath) + window.OCA.Files.Sidebar.close() window.OCA.Files.Sidebar.setActiveTab('libresign')