Skip to content

Commit fcfe05e

Browse files
authored
Merge pull request #6314 from LibreSign/backport/6313/stable31
[stable31] fix: update Files list when envelope is created
2 parents 7fe7176 + 4ddd1a7 commit fcfe05e

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/actions/openInLibreSignAction.js

Lines changed: 23 additions & 1 deletion
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'),
@@ -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

Comments
 (0)