|
2 | 2 | * SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors |
3 | 3 | * SPDX-License-Identifier: AGPL-3.0-or-later |
4 | 4 | */ |
5 | | -import { registerFileAction, FileAction } from '@nextcloud/files' |
| 5 | +import { registerFileAction, FileAction, getSidebar } from '@nextcloud/files' |
6 | 6 | import { getCapabilities } from '@nextcloud/capabilities' |
7 | 7 | import { loadState } from '@nextcloud/initial-state' |
8 | 8 | import { translate as t } from '@nextcloud/l10n' |
@@ -71,10 +71,9 @@ export const action = new FileAction({ |
71 | 71 | * Single file: open in sidebar |
72 | 72 | */ |
73 | 73 | async exec({ nodes }) { |
74 | | - window.OCA.Files.Sidebar.close() |
75 | 74 | const node = nodes[0] |
76 | | - await window.OCA.Files.Sidebar.open(node.path) |
77 | | - window.OCA.Files.Sidebar.setActiveTab('libresign') |
| 75 | + await sidebar.open(node, 'libresign') |
| 76 | + sidebar.setActiveTab('libresign') |
78 | 77 | return null |
79 | 78 | }, |
80 | 79 |
|
@@ -103,16 +102,15 @@ export const action = new FileAction({ |
103 | 102 | settings: { |
104 | 103 | path: envelopePath, |
105 | 104 | }, |
106 | | - }).then((response) => { |
| 105 | + }).then(async (response) => { |
107 | 106 | const envelopeData = response.data?.ocs?.data |
108 | 107 |
|
109 | 108 | window.OCA.Libresign.pendingEnvelope = envelopeData |
110 | 109 |
|
111 | | - window.OCA.Files.Sidebar.close() |
112 | | - |
113 | | - window.OCA.Files.Sidebar.setActiveTab('libresign') |
| 110 | + const sidebar = getSidebar() |
114 | 111 | const firstNode = nodes[0] |
115 | | - window.OCA.Files.Sidebar.open(firstNode.path) |
| 112 | + await sidebar.open(firstNode, 'libresign') |
| 113 | + sidebar.setActiveTab('libresign') |
116 | 114 |
|
117 | 115 | return new Array(nodes.length).fill(null) |
118 | 116 | }).catch((error) => { |
|
0 commit comments