From 2d3113230f1baf91ffa8fd964b4bdaf089a0a7bf 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 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/actions/openInLibreSignAction.js b/src/actions/openInLibreSignAction.js index aff1150789..6a45cc32ea 100644 --- a/src/actions/openInLibreSignAction.js +++ b/src/actions/openInLibreSignAction.js @@ -3,6 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ import { registerFileAction, FileAction, getSidebar } from '@nextcloud/files' +import { emit } from '@nextcloud/event-bus' import { getCapabilities } from '@nextcloud/capabilities' import { loadState } from '@nextcloud/initial-state' import { translate as t } from '@nextcloud/l10n' @@ -10,6 +11,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 +43,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'), @@ -107,6 +128,8 @@ export const action = new FileAction({ window.OCA.Libresign.pendingEnvelope = envelopeData + await emitEnvelopeNodeCreated(envelopePath) + const sidebar = getSidebar() const firstNode = nodes[0] await sidebar.open(firstNode, 'libresign')