diff --git a/apps/comments/src/comments-tab.js b/apps/comments/src/comments-tab.js index 1a367cc18ee8a..73038412bd306 100644 --- a/apps/comments/src/comments-tab.js +++ b/apps/comments/src/comments-tab.js @@ -49,6 +49,9 @@ if (loadState('comments', 'activityEnabled', false) && OCA?.Activity?.registerSi TabInstance = new OCA.Comments.View('files', { // Better integration with vue parent component parent: context, + propsData: { + resourceId: fileInfo.id, + }, }) // Only mount after we have all the info we need await TabInstance.update(fileInfo.id) diff --git a/apps/comments/src/views/Comments.vue b/apps/comments/src/views/Comments.vue index 7936610ad1235..037f8d6a3f0f8 100644 --- a/apps/comments/src/views/Comments.vue +++ b/apps/comments/src/views/Comments.vue @@ -31,7 +31,7 @@ :resource-type="resourceType" :editor="true" :user-data="userData" - :resource-id="resourceId" + :resource-id="currentResourceId" class="comments__writer" @new="onNewComment" /> @@ -52,7 +52,7 @@ :auto-complete="autoComplete" :resource-type="resourceType" :message.sync="comment.props.message" - :resource-id="resourceId" + :resource-id="currentResourceId" :user-data="genMentionsData(comment.props.mentions)" class="comments__list" @delete="onDelete" /> @@ -125,7 +125,7 @@ export default { loading: false, done: false, - resourceId: null, + currentResourceId: this.resourceId, offset: 0, comments: [], @@ -145,13 +145,19 @@ export default { }, }, + watch: { + resourceId() { + this.currentResourceId = this.resourceId + }, + }, + methods: { t, async onVisibilityChange(isVisible) { if (isVisible) { try { - await markCommentsAsRead(this.resourceType, this.resourceId, new Date()) + await markCommentsAsRead(this.resourceType, this.currentResourceId, new Date()) } catch (e) { showError(e.message || t('comments', 'Failed to mark comments as read')) } @@ -164,7 +170,7 @@ export default { * @param {number} resourceId the current resourceId (fileId...) */ async update(resourceId) { - this.resourceId = resourceId + this.currentResourceId = resourceId this.resetState() this.getComments() }, @@ -203,7 +209,7 @@ export default { // Fetch comments const { data: comments } = await request({ resourceType: this.resourceType, - resourceId: this.resourceId, + resourceId: this.currentResourceId, }, { offset: this.offset }) || { data: [] } this.logger.debug(`Processed ${comments.length} comments`, { comments }) diff --git a/apps/files/src/views/Sidebar.vue b/apps/files/src/views/Sidebar.vue index c2aed34d0461f..398144e2414a2 100644 --- a/apps/files/src/views/Sidebar.vue +++ b/apps/files/src/views/Sidebar.vue @@ -33,7 +33,7 @@ @opened="handleOpened" @closing="handleClosing" @closed="handleClosed"> -