From bd7c29c362c3bbd9f1ff495674a1980b54d14104 Mon Sep 17 00:00:00 2001 From: Grigory Vodyanov Date: Thu, 13 Jun 2024 11:39:18 +0200 Subject: [PATCH] fix(comments): comment deleting with activities installed Signed-off-by: Grigory Vodyanov Signed-off-by: Grigory V Signed-off-by: nextcloud-command --- apps/comments/src/comments-activity-tab.ts | 11 ++++++-- apps/comments/src/components/Comment.vue | 9 +++++- apps/comments/src/mixins/CommentMixin.js | 10 +++++++ .../comments/src/services/CommentsInstance.js | 5 ++++ .../comments/src/store/deletedCommentLimbo.js | 28 +++++++++++++++++++ dist/3920-3920.js.license | 8 ++++++ dist/7462-7462.js | 4 +-- dist/7462-7462.js.license | 8 ++++++ dist/7462-7462.js.map | 2 +- dist/8057-8057.js.license | 8 ++++++ dist/comments-comments-app.js | 4 +-- dist/comments-comments-app.js.license | 8 ++++++ dist/comments-comments-app.js.map | 2 +- dist/comments-comments-tab.js | 4 +-- dist/comments-comments-tab.js.license | 8 ++++++ dist/comments-comments-tab.js.map | 2 +- dist/core-common.js | 4 +-- dist/core-common.js.map | 2 +- dist/files_sharing-additionalScripts.js | 4 +-- dist/files_sharing-additionalScripts.js.map | 2 +- 20 files changed, 115 insertions(+), 18 deletions(-) create mode 100644 apps/comments/src/store/deletedCommentLimbo.js diff --git a/apps/comments/src/comments-activity-tab.ts b/apps/comments/src/comments-activity-tab.ts index 765777884f286..f67f702d97bc9 100644 --- a/apps/comments/src/comments-activity-tab.ts +++ b/apps/comments/src/comments-activity-tab.ts @@ -7,6 +7,10 @@ import Vue from 'vue' import logger from './logger.js' import { getComments } from './services/GetComments.js' +import { PiniaVuePlugin, createPinia } from 'pinia' + +Vue.use(PiniaVuePlugin) + let ActivityTabPluginView let ActivityTabPluginInstance @@ -16,9 +20,11 @@ let ActivityTabPluginInstance export function registerCommentsPlugins() { window.OCA.Activity.registerSidebarAction({ mount: async (el, { context, fileInfo, reload }) => { + const pinia = createPinia() + if (!ActivityTabPluginView) { const { default: ActivityCommmentAction } = await import('./views/ActivityCommentAction.vue') - ActivityTabPluginView = Vue.extend(ActivityCommmentAction) + ActivityTabPluginView = ActivityCommmentAction } ActivityTabPluginInstance = new ActivityTabPluginView({ parent: context, @@ -26,6 +32,7 @@ export function registerCommentsPlugins() { reloadCallback: reload, resourceId: fileInfo.id, }, + pinia, }) ActivityTabPluginInstance.$mount(el) logger.info('Comments plugin mounted in Activity sidebar action', { fileInfo }) @@ -42,7 +49,7 @@ export function registerCommentsPlugins() { const { data: comments } = await getComments({ resourceType: 'files', resourceId: fileInfo.id }, { limit, offset }) logger.debug('Loaded comments', { fileInfo, comments }) const { default: CommentView } = await import('./views/ActivityCommentEntry.vue') - const CommentsViewObject = Vue.extend(CommentView) + const CommentsViewObject = CommentView return comments.map((comment) => ({ timestamp: moment(comment.props.creationDateTime).toDate().getTime(), diff --git a/apps/comments/src/components/Comment.vue b/apps/comments/src/components/Comment.vue index 8c6287d9ecba9..29711ad687db0 100644 --- a/apps/comments/src/components/Comment.vue +++ b/apps/comments/src/components/Comment.vue @@ -4,7 +4,7 @@ -->