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')