From f5d91dc0201c03e9159b427da16137cbeab867cd Mon Sep 17 00:00:00 2001 From: Jos Poortvliet Date: Sun, 23 Aug 2026 16:11:55 +0200 Subject: [PATCH 1/2] fix(comments): recreate Vue app when re-mounting Activity sidebar comment editor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The comment editor Vue app instance was kept in a closure variable and reused across Activity tab mount/unmount cycles. unmount() destroyed the app via app.unmount() but never reset the variable, so the next mount() skipped creating a new app and called mount() on an already- destroyed instance — a silent no-op. This made the comment field disappear after leaving and returning to the Activity tab, only recoverable via a full page reload. Reset `app` to undefined after unmounting so the editor is recreated on the next mount. Fixes #63487 Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Jos Poortvliet --- apps/comments/src/comments-activity-tab.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/comments/src/comments-activity-tab.ts b/apps/comments/src/comments-activity-tab.ts index b738242cf574c..88c62447fd026 100644 --- a/apps/comments/src/comments-activity-tab.ts +++ b/apps/comments/src/comments-activity-tab.ts @@ -38,6 +38,7 @@ export function registerCommentsPlugins() { unmount: () => { // destroy previous instance if available app?.unmount() + app = undefined }, }) From c2074717707287c6d1d9aeab4d4102f3526b1bb6 Mon Sep 17 00:00:00 2001 From: nextcloud-command Date: Mon, 7 Sep 2026 12:19:53 +0000 Subject: [PATCH 2/2] chore(assets): Recompile assets Signed-off-by: nextcloud-command --- dist/comments-comments-tab.mjs | 2 +- dist/comments-comments-tab.mjs.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/comments-comments-tab.mjs b/dist/comments-comments-tab.mjs index 31233120d0ebc..b783f249724fc 100644 --- a/dist/comments-comments-tab.mjs +++ b/dist/comments-comments-tab.mjs @@ -1,3 +1,3 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('', '', 'dist/ActivityCommentAction-Cr14M0VJ.chunk.mjs'),window.OC.filePath('', '', 'dist/index-BZUfSSUR.chunk.mjs'),window.OC.filePath('', '', 'dist/preload-helper-B3c9Y6Ia.chunk.mjs'),window.OC.filePath('', '', 'dist/mdi-AfC8gRDi.chunk.mjs'),window.OC.filePath('', '', 'dist/NcModal-Bh42Y6HE.chunk.mjs'),window.OC.filePath('', '', 'dist/ArrowRight-DL6H-z1z.chunk.mjs'),window.OC.filePath('', '', 'dist/createElementId-Cu-wR4zW.chunk.mjs'),window.OC.filePath('', '', 'dist/index-BZ9H2NGr.chunk.mjs'),window.OC.filePath('', '', 'dist/formatRelative-B6SwQwmy.chunk.mjs'),window.OC.filePath('', '', 'dist/_plugin-vue_export-helper-CqVUm19z.chunk.mjs'),window.OC.filePath('', '', 'dist/common-createElementId-C_oBIsvc.chunk.css'),window.OC.filePath('', '', 'dist/common-ArrowRight-3plNpBrB.chunk.css'),window.OC.filePath('', '', 'dist/common-NcModal-CxlqxDk0.chunk.css'),window.OC.filePath('', '', 'dist/Check-Cxn5cWmd.chunk.mjs'),window.OC.filePath('', '', 'dist/common-Check-BYHcrfvW.chunk.css'),window.OC.filePath('', '', 'dist/common-mdi-DYA_tnKg.chunk.css'),window.OC.filePath('', '', 'dist/TrashCanOutline-Tn7_xhh7.chunk.mjs'),window.OC.filePath('', '', 'dist/common-TrashCanOutline-BWNFKLbC.chunk.css'),window.OC.filePath('', '', 'dist/CommentView-D4VksW8F.chunk.mjs'),window.OC.filePath('', '', 'dist/NcActionButton-DNc0Bs06.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcActionButton-BQBDvDX2.chunk.css'),window.OC.filePath('', '', 'dist/NcActionSeparator-DnEqLSqe.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcActionSeparator-pXJ_-D_I.chunk.css'),window.OC.filePath('', '', 'dist/NcAvatar-BlkWsJW8.chunk.mjs'),window.OC.filePath('', '', 'dist/index-BFCx3SEP.chunk.mjs'),window.OC.filePath('', '', 'dist/public-CbrTZt0b.chunk.mjs'),window.OC.filePath('', '', 'dist/autolink-CTGrhdQD.chunk.mjs'),window.OC.filePath('', '', 'dist/common-autolink-DJV5doQl.chunk.css'),window.OC.filePath('', '', 'dist/PencilOutline-BXbwQVTF.chunk.mjs'),window.OC.filePath('', '', 'dist/NcUserStatusIcon-NAlIfAHL.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcUserStatusIcon-Bq_6hmXG.chunk.css'),window.OC.filePath('', '', 'dist/NcActionLink-C1G8aUyO.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcActionLink-iJnZg6ii.chunk.css'),window.OC.filePath('', '', 'dist/NcActionRouter-FN3FEb6D.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcActionRouter-C1KErZDl.chunk.css'),window.OC.filePath('', '', 'dist/NcActionText-B653EuoW.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcActionText-BzbAkUEn.chunk.css'),window.OC.filePath('', '', 'dist/common-NcAvatar-Bj2mvPeT.chunk.css'),window.OC.filePath('', '', 'dist/NcUserBubble-DP-lTV4_.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcUserBubble-f2DD9EAL.chunk.css'),window.OC.filePath('', '', 'dist/activity-Do9u8Krl.chunk.mjs'),window.OC.filePath('', '', 'dist/GetComments-D06_e4_5.chunk.mjs'),window.OC.filePath('', '', 'dist/index-DLdIy3u6.chunk.mjs'),window.OC.filePath('', '', 'dist/externalStorageUtils-B-QuSdG4.chunk.mjs'),window.OC.filePath('', '', 'dist/dav-0GZfQvFx.chunk.mjs'),window.OC.filePath('', '', 'dist/common-CommentView-f1JWd1O0.chunk.css'),window.OC.filePath('', '', 'dist/comments-ActivityCommentAction-BNcHFi_U.chunk.css'),window.OC.filePath('', '', 'dist/ActivityCommentEntry-2SJ1-POW.chunk.mjs'),window.OC.filePath('', '', 'dist/comments-ActivityCommentEntry-DkLG8AtJ.chunk.css'),window.OC.filePath('', '', 'dist/FilesSidebarTab-CHb3kAOL.chunk.mjs'),window.OC.filePath('', '', 'dist/NcEmptyContent-BDU5IM5c.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcEmptyContent-Don1d5Bd.chunk.css'),window.OC.filePath('', '', 'dist/common-FilesSidebarTab-Dk-ISsTg.chunk.css')])))=>i.map(i=>d[i]); -import{e as l,_ as m,f as c,d as w}from"./preload-helper-B3c9Y6Ia.chunk.mjs";import{r as _}from"./index-HIhdXbmF.chunk.mjs";import{t as g}from"./index-BZ9H2NGr.chunk.mjs";import{l as r,i as A}from"./activity-Do9u8Krl.chunk.mjs";import{g as v}from"./GetComments-D06_e4_5.chunk.mjs";import"./externalStorageUtils-B-QuSdG4.chunk.mjs";import"./formatRelative-B6SwQwmy.chunk.mjs";import"./public-CbrTZt0b.chunk.mjs";import"./_plugin-vue_export-helper-CqVUm19z.chunk.mjs";import"./index-DLdIy3u6.chunk.mjs";import"./dav-0GZfQvFx.chunk.mjs";const y='';function V(){let o;window.OCA.Activity.registerSidebarAction({mount:async(t,{node:e,reload:i})=>{const a=l();if(!o){const{default:s}=await m(async()=>{const{default:n}=await import("./ActivityCommentAction-Cr14M0VJ.chunk.mjs");return{default:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46]),import.meta.url);o=c(s,{reloadCallback:i,resourceId:e.fileid})}o.use(a),o.mount(t),r.info("Comments plugin mounted in Activity sidebar action",{node:e})},unmount:()=>{o?.unmount()}}),window.OCA.Activity.registerSidebarEntries(async({node:t,limit:e,offset:i})=>{const{data:a}=await v({resourceType:"files",resourceId:t.fileid},{limit:e,offset:i??0});r.debug("Loaded comments",{node:t,comments:a});const{default:s}=await m(async()=>{const{default:n}=await import("./ActivityCommentEntry-2SJ1-POW.chunk.mjs");return{default:n}},__vite__mapDeps([47,7,8,9,18,2,19,5,6,10,11,4,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,13,14,37,3,15,38,39,16,17,1,40,41,42,43,44,45,48]),import.meta.url);return a.map(n=>({_CommentsViewInstance:void 0,timestamp:Date.parse(n.props?.creationDateTime??""),mount(f,{reload:p}){const d=c(s,{comment:n,resourceId:t.fileid,reloadCallback:p});d.mount(f),this._CommentsViewInstance=d},unmount(){this._CommentsViewInstance?.unmount()}}))}),window.OCA.Activity.registerSidebarFilter(t=>t.type!=="comments"),r.info("Comments plugin registered for Activity sidebar action")}const u="comments_files-sidebar-tab";A()?window.addEventListener("DOMContentLoaded",function(){V()}):_({id:"comments",displayName:g("comments","Comments"),iconSvgInline:y,order:50,tagName:u,async onInit(){const{default:o}=await m(async()=>{const{default:e}=await import("./FilesSidebarTab-CHb3kAOL.chunk.mjs").then(i=>i.F);return{default:e}},__vite__mapDeps([49,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,23,24,25,26,27,28,29,30,19,20,31,32,33,34,35,36,37,50,51,18,21,22,38,39,40,41,42,43,44,45,52]),import.meta.url),t=w(o,{configureApp(e){const i=l();e.use(i)},shadowRoot:!1});window.customElements.define(u,t)}}); +import{e as l,_ as m,f as c,d as w}from"./preload-helper-B3c9Y6Ia.chunk.mjs";import{r as _}from"./index-HIhdXbmF.chunk.mjs";import{t as g}from"./index-BZ9H2NGr.chunk.mjs";import{l as r,i as v}from"./activity-Do9u8Krl.chunk.mjs";import{g as A}from"./GetComments-D06_e4_5.chunk.mjs";import"./externalStorageUtils-B-QuSdG4.chunk.mjs";import"./formatRelative-B6SwQwmy.chunk.mjs";import"./public-CbrTZt0b.chunk.mjs";import"./_plugin-vue_export-helper-CqVUm19z.chunk.mjs";import"./index-DLdIy3u6.chunk.mjs";import"./dav-0GZfQvFx.chunk.mjs";const y='';function V(){let e;window.OCA.Activity.registerSidebarAction({mount:async(t,{node:o,reload:i})=>{const a=l();if(!e){const{default:s}=await m(async()=>{const{default:n}=await import("./ActivityCommentAction-Cr14M0VJ.chunk.mjs");return{default:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46]),import.meta.url);e=c(s,{reloadCallback:i,resourceId:o.fileid})}e.use(a),e.mount(t),r.info("Comments plugin mounted in Activity sidebar action",{node:o})},unmount:()=>{e?.unmount(),e=void 0}}),window.OCA.Activity.registerSidebarEntries(async({node:t,limit:o,offset:i})=>{const{data:a}=await A({resourceType:"files",resourceId:t.fileid},{limit:o,offset:i??0});r.debug("Loaded comments",{node:t,comments:a});const{default:s}=await m(async()=>{const{default:n}=await import("./ActivityCommentEntry-2SJ1-POW.chunk.mjs");return{default:n}},__vite__mapDeps([47,7,8,9,18,2,19,5,6,10,11,4,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,13,14,37,3,15,38,39,16,17,1,40,41,42,43,44,45,48]),import.meta.url);return a.map(n=>({_CommentsViewInstance:void 0,timestamp:Date.parse(n.props?.creationDateTime??""),mount(f,{reload:p}){const d=c(s,{comment:n,resourceId:t.fileid,reloadCallback:p});d.mount(f),this._CommentsViewInstance=d},unmount(){this._CommentsViewInstance?.unmount()}}))}),window.OCA.Activity.registerSidebarFilter(t=>t.type!=="comments"),r.info("Comments plugin registered for Activity sidebar action")}const u="comments_files-sidebar-tab";v()?window.addEventListener("DOMContentLoaded",function(){V()}):_({id:"comments",displayName:g("comments","Comments"),iconSvgInline:y,order:50,tagName:u,async onInit(){const{default:e}=await m(async()=>{const{default:o}=await import("./FilesSidebarTab-CHb3kAOL.chunk.mjs").then(i=>i.F);return{default:o}},__vite__mapDeps([49,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,23,24,25,26,27,28,29,30,19,20,31,32,33,34,35,36,37,50,51,18,21,22,38,39,40,41,42,43,44,45,52]),import.meta.url),t=w(e,{configureApp(o){const i=l();o.use(i)},shadowRoot:!1});window.customElements.define(u,t)}}); //# sourceMappingURL=comments-comments-tab.mjs.map diff --git a/dist/comments-comments-tab.mjs.map b/dist/comments-comments-tab.mj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AA,CACjB,EAEDH,EAAI,MAAMgB,CAAO,EACjB,KAAK,sBAAwBhB,CAC9B,EACA,SAAU,CACT,KAAK,uBAAuB,SAC7B,GACC,CACH,CAAC,EAED,OAAO,IAAI,SAAS,sBAAuBiB,GAAaA,EAAS,OAAS,UAAU,EACpFR,EAAO,KAAK,wDAAwD,CACrE,CClEA,MAAMS,EAAU,6BAEZC,IAEH,OAAO,iBAAiB,mBAAoB,UAAW,CACtDpB,EAAA,CACD,CAAC,EAEDqB,EAAmB,CAClB,GAAI,WACJ,YAAaC,EAAE,WAAY,UAAU,EACrC,cAAevB,EACf,MAAO,GACP,QAAAoB,EACA,MAAM,QAAS,CACd,KAAM,CAAE,QAASI,CAAA,EAAoB,MAAAf,EAAA,wBAAAe,CAAA,eAAa,sCAA6B,OAAAC,KAAA,kBAAAD,CAAA,iLAEzEE,EAAyBC,EAAoBH,EAAiB,CACnE,aAAatB,EAAK,CACjB,MAAMI,EAAQC,EAAA,EACdL,EAAI,IAAII,CAAK,CACd,EACA,WAAY,GACZ,EAED,OAAO,eAAe,OAAOc,EAASM,CAAsB,CAC7D,EACA","names":["MessageReplyText","registerCommentsPlugins","app","el","node","reload","pinia","createPinia","ActivityCommentAction","__vitePreload","createApp","logger","limit","offset","comments","getComments","CommentView","comment","element","activity","tagName","isUsingActivityIntegration","registerSidebarTab","t","FilesSidebarTab","n","FilesSidebarTabElement","defineCustomElement"],"ignoreList":[0],"sources":["../node_modules/@mdi/svg/svg/message-reply-text.svg?raw","../build/frontend/apps/comments/src/comments-activity-tab.ts","../build/frontend/apps/comments/src/files-sidebar.ts"],"sourcesContent":["export default \"\"","/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { INode } from '@nextcloud/files'\nimport type { App } from 'vue'\n\nimport { createPinia } from 'pinia'\nimport { createApp } from 'vue'\nimport logger from './logger.ts'\nimport { getComments } from './services/GetComments.ts'\n\n/**\n * Register the comments plugins for the Activity sidebar\n */\nexport function registerCommentsPlugins() {\n\tlet app: App\n\n\twindow.OCA.Activity.registerSidebarAction({\n\t\tmount: async (el: HTMLElement, { node, reload }: { node: INode, reload: () => void }) => {\n\t\t\tconst pinia = createPinia()\n\n\t\t\tif (!app) {\n\t\t\t\tconst { default: ActivityCommentAction } = await import('./views/ActivityCommentAction.vue')\n\t\t\t\tapp = createApp(\n\t\t\t\t\tActivityCommentAction,\n\t\t\t\t\t{\n\t\t\t\t\t\treloadCallback: reload,\n\t\t\t\t\t\tresourceId: node.fileid,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t\tapp.use(pinia)\n\t\t\tapp.mount(el)\n\t\t\tlogger.info('Comments plugin mounted in Activity sidebar action', { node })\n\t\t},\n\t\tunmount: () => {\n\t\t\t// destroy previous instance if available\n\t\t\tapp?.unmount()\n\t\t},\n\t})\n\n\twindow.OCA.Activity.registerSidebarEntries(async ({ node, limit, offset }: { node: INode, limit?: number, offset?: number }) => {\n\t\tconst { data: comments } = await getComments(\n\t\t\t{ resourceType: 'files', resourceId: node.fileid },\n\t\t\t{\n\t\t\t\tlimit,\n\t\t\t\toffset: offset ?? 0,\n\t\t\t},\n\t\t)\n\t\tlogger.debug('Loaded comments', { node, comments })\n\t\tconst { default: CommentView } = await import('./views/ActivityCommentEntry.vue')\n\n\t\treturn comments.map((comment) => ({\n\t\t\t_CommentsViewInstance: undefined as App | undefined,\n\n\t\t\ttimestamp: Date.parse(comment.props?.creationDateTime as string | undefined ?? ''),\n\n\t\t\tmount(element: HTMLElement, { reload }) {\n\t\t\t\tconst app = createApp(\n\t\t\t\t\tCommentView,\n\t\t\t\t\t{\n\t\t\t\t\t\tcomment,\n\t\t\t\t\t\tresourceId: node.fileid,\n\t\t\t\t\t\treloadCallback: reload,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tapp.mount(element)\n\t\t\t\tthis._CommentsViewInstance = app\n\t\t\t},\n\t\t\tunmount() {\n\t\t\t\tthis._CommentsViewInstance?.unmount()\n\t\t\t},\n\t\t}))\n\t})\n\n\twindow.OCA.Activity.registerSidebarFilter((activity) => activity.type !== 'comments')\n\tlogger.info('Comments plugin registered for Activity sidebar action')\n}\n","/*!\n * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport MessageReplyText from '@mdi/svg/svg/message-reply-text.svg?raw'\nimport { registerSidebarTab } from '@nextcloud/files'\nimport { t } from '@nextcloud/l10n'\nimport { createPinia } from 'pinia'\nimport { defineCustomElement } from 'vue'\nimport { registerCommentsPlugins } from './comments-activity-tab.ts'\nimport { isUsingActivityIntegration } from './utils/activity.ts'\n\nconst tagName = 'comments_files-sidebar-tab'\n\nif (isUsingActivityIntegration()) {\n\t// Do not mount own tab but mount into activity\n\twindow.addEventListener('DOMContentLoaded', function() {\n\t\tregisterCommentsPlugins()\n\t})\n} else {\n\tregisterSidebarTab({\n\t\tid: 'comments',\n\t\tdisplayName: t('comments', 'Comments'),\n\t\ticonSvgInline: MessageReplyText,\n\t\torder: 50,\n\t\ttagName,\n\t\tasync onInit() {\n\t\t\tconst { default: FilesSidebarTab } = await import('./views/FilesSidebarTab.vue')\n\n\t\t\tconst FilesSidebarTabElement = defineCustomElement(FilesSidebarTab, {\n\t\t\t\tconfigureApp(app) {\n\t\t\t\t\tconst pinia = createPinia()\n\t\t\t\t\tapp.use(pinia)\n\t\t\t\t},\n\t\t\t\tshadowRoot: false,\n\t\t\t})\n\n\t\t\twindow.customElements.define(tagName, FilesSidebarTabElement)\n\t\t},\n\t})\n}\n"],"file":"comments-comments-tab.mjs"} \ No newline at end of file +{"version":3,"mappings":";shBAAA,MAAAA,EAAe,+NCgBR,SAASC,GAA0B,CACzC,IAAIC,EAEJ,OAAO,IAAI,SAAS,sBAAsB,CACzC,MAAO,MAAOC,EAAiB,CAAE,KAAAC,EAAM,OAAAC,KAAkD,CACxF,MAAMC,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BAAoB,UAAW,CACtDpB,EAAA,CACD,CAAC,EAEDqB,EAAmB,CAClB,GAAI,WACJ,YAAaC,EAAE,WAAY,UAAU,EACrC,cAAevB,EACf,MAAO,GACP,QAAAoB,EACA,MAAM,QAAS,CACd,KAAM,CAAE,QAASI,CAAA,EAAoB,MAAAf,EAAA,wBAAAe,CAAA,eAAa,sCAA6B,OAAAC,KAAA,kBAAAD,CAAA,iLAEzEE,EAAyBC,EAAoBH,EAAiB,CACnE,aAAatB,EAAK,CACjB,MAAMI,EAAQC,EAAA,EACdL,EAAI,IAAII,CAAK,CACd,EACA,WAAY,GACZ,EAED,OAAO,eAAe,OAAOc,EAASM,CAAsB,CAC7D,EACA","names":["MessageReplyText","registerCommentsPlugins","app","el","node","reload","pinia","createPinia","ActivityCommentAction","__vitePreload","createApp","logger","limit","offset","comments","getComments","CommentView","comment","element","activity","tagName","isUsingActivityIntegration","registerSidebarTab","t","FilesSidebarTab","n","FilesSidebarTabElement","defineCustomElement"],"ignoreList":[0],"sources":["../node_modules/@mdi/svg/svg/message-reply-text.svg?raw","../build/frontend/apps/comments/src/comments-activity-tab.ts","../build/frontend/apps/comments/src/files-sidebar.ts"],"sourcesContent":["export default \"\"","/*!\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { INode } from '@nextcloud/files'\nimport type { App } from 'vue'\n\nimport { createPinia } from 'pinia'\nimport { createApp } from 'vue'\nimport logger from './logger.ts'\nimport { getComments } from './services/GetComments.ts'\n\n/**\n * Register the comments plugins for the Activity sidebar\n */\nexport function registerCommentsPlugins() {\n\tlet app: App\n\n\twindow.OCA.Activity.registerSidebarAction({\n\t\tmount: async (el: HTMLElement, { node, reload }: { node: INode, reload: () => void }) => {\n\t\t\tconst pinia = createPinia()\n\n\t\t\tif (!app) {\n\t\t\t\tconst { default: ActivityCommentAction } = await import('./views/ActivityCommentAction.vue')\n\t\t\t\tapp = createApp(\n\t\t\t\t\tActivityCommentAction,\n\t\t\t\t\t{\n\t\t\t\t\t\treloadCallback: reload,\n\t\t\t\t\t\tresourceId: node.fileid,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t\tapp.use(pinia)\n\t\t\tapp.mount(el)\n\t\t\tlogger.info('Comments plugin mounted in Activity sidebar action', { node })\n\t\t},\n\t\tunmount: () => {\n\t\t\t// destroy previous instance if available\n\t\t\tapp?.unmount()\n\t\t\tapp = undefined\n\t\t},\n\t})\n\n\twindow.OCA.Activity.registerSidebarEntries(async ({ node, limit, offset }: { node: INode, limit?: number, offset?: number }) => {\n\t\tconst { data: comments } = await getComments(\n\t\t\t{ resourceType: 'files', resourceId: node.fileid },\n\t\t\t{\n\t\t\t\tlimit,\n\t\t\t\toffset: offset ?? 0,\n\t\t\t},\n\t\t)\n\t\tlogger.debug('Loaded comments', { node, comments })\n\t\tconst { default: CommentView } = await import('./views/ActivityCommentEntry.vue')\n\n\t\treturn comments.map((comment) => ({\n\t\t\t_CommentsViewInstance: undefined as App | undefined,\n\n\t\t\ttimestamp: Date.parse(comment.props?.creationDateTime as string | undefined ?? ''),\n\n\t\t\tmount(element: HTMLElement, { reload }) {\n\t\t\t\tconst app = createApp(\n\t\t\t\t\tCommentView,\n\t\t\t\t\t{\n\t\t\t\t\t\tcomment,\n\t\t\t\t\t\tresourceId: node.fileid,\n\t\t\t\t\t\treloadCallback: reload,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tapp.mount(element)\n\t\t\t\tthis._CommentsViewInstance = app\n\t\t\t},\n\t\t\tunmount() {\n\t\t\t\tthis._CommentsViewInstance?.unmount()\n\t\t\t},\n\t\t}))\n\t})\n\n\twindow.OCA.Activity.registerSidebarFilter((activity) => activity.type !== 'comments')\n\tlogger.info('Comments plugin registered for Activity sidebar action')\n}\n","/*!\n * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport MessageReplyText from '@mdi/svg/svg/message-reply-text.svg?raw'\nimport { registerSidebarTab } from '@nextcloud/files'\nimport { t } from '@nextcloud/l10n'\nimport { createPinia } from 'pinia'\nimport { defineCustomElement } from 'vue'\nimport { registerCommentsPlugins } from './comments-activity-tab.ts'\nimport { isUsingActivityIntegration } from './utils/activity.ts'\n\nconst tagName = 'comments_files-sidebar-tab'\n\nif (isUsingActivityIntegration()) {\n\t// Do not mount own tab but mount into activity\n\twindow.addEventListener('DOMContentLoaded', function() {\n\t\tregisterCommentsPlugins()\n\t})\n} else {\n\tregisterSidebarTab({\n\t\tid: 'comments',\n\t\tdisplayName: t('comments', 'Comments'),\n\t\ticonSvgInline: MessageReplyText,\n\t\torder: 50,\n\t\ttagName,\n\t\tasync onInit() {\n\t\t\tconst { default: FilesSidebarTab } = await import('./views/FilesSidebarTab.vue')\n\n\t\t\tconst FilesSidebarTabElement = defineCustomElement(FilesSidebarTab, {\n\t\t\t\tconfigureApp(app) {\n\t\t\t\t\tconst pinia = createPinia()\n\t\t\t\t\tapp.use(pinia)\n\t\t\t\t},\n\t\t\t\tshadowRoot: false,\n\t\t\t})\n\n\t\t\twindow.customElements.define(tagName, FilesSidebarTabElement)\n\t\t},\n\t})\n}\n"],"file":"comments-comments-tab.mjs"} \ No newline at end of file