From 4c5acb23b4b9670e0fdcec47b04e630b881d7ecb Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Thu, 24 Oct 2024 15:46:22 +0200 Subject: [PATCH] fix(systemtags): single-node bulk tagging action Signed-off-by: skjnldsv --- .../src/components/SystemTagPicker.vue | 2 +- .../src/files_actions/bulkSystemTagsAction.ts | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/apps/systemtags/src/components/SystemTagPicker.vue b/apps/systemtags/src/components/SystemTagPicker.vue index 732d509ac24e7..db93e6be6cfe0 100644 --- a/apps/systemtags/src/components/SystemTagPicker.vue +++ b/apps/systemtags/src/components/SystemTagPicker.vue @@ -409,7 +409,7 @@ export default defineComponent({ this.status = Status.DONE setTimeout(() => { this.opened = false - this.$emit('close', null) + this.$emit('close', true) }, 2000) }, diff --git a/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts b/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts index 7e7c29f64f01e..f91691c561a64 100644 --- a/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts +++ b/apps/systemtags/src/files_actions/bulkSystemTagsAction.ts @@ -11,6 +11,17 @@ import { t } from '@nextcloud/l10n' import TagMultipleSvg from '@mdi/svg/svg/tag-multiple.svg?raw' +async function execBatch(nodes: Node[]): Promise<(null|boolean)[]> { + const response = await new Promise((resolve) => { + spawnDialog(defineAsyncComponent(() => import('../components/SystemTagPicker.vue')), { + nodes, + }, (status) => { + resolve(status as null|boolean) + }) + }) + return Array(nodes.length).fill(response) +} + export const action = new FileAction({ id: 'systemtags:bulk', displayName: () => t('systemtags', 'Manage tags'), @@ -25,18 +36,9 @@ export const action = new FileAction({ return true }, - async exec() { - return null + async exec(node: Node) { + return execBatch([node])[0] }, - async execBatch(nodes: Node[]) { - const response = await new Promise((resolve) => { - spawnDialog(defineAsyncComponent(() => import('../components/SystemTagPicker.vue')), { - nodes, - }, (status) => { - resolve(status as null|boolean) - }) - }) - return Array(nodes.length).fill(response) - }, + execBatch, })