aboutsummaryrefslogtreecommitdiffstats
path: root/apps/comments/src
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-04-17 00:15:46 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-04-17 20:09:14 +0200
commit6c9ca8b0253c67c499cf233235a2aad8b72f48ce (patch)
tree2b206374f7f40a3aa85544efd51c8eaa4d2ed64f /apps/comments/src
parentb4004a258296bbe8563a5c76f8e611976c2a7ffd (diff)
downloadnextcloud-server-6c9ca8b0253c67c499cf233235a2aad8b72f48ce.tar.gz
nextcloud-server-6c9ca8b0253c67c499cf233235a2aad8b72f48ce.zip
fix(comments): Fix issues thrown by comments sidebar tab code
When the comments tab is used instead of the merged activity+comments, then some issues are throws due to prop altering and duplicated names (resourceId as prop and data). This is fixed as well as some other vue related errors in the sidebar Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/comments/src')
-rw-r--r--apps/comments/src/comments-tab.js3
-rw-r--r--apps/comments/src/views/Comments.vue22
2 files changed, 17 insertions, 8 deletions
diff --git a/apps/comments/src/comments-tab.js b/apps/comments/src/comments-tab.js
index 1a367cc18ee..73038412bd3 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 326091723b9..f6fb4387596 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" />
@@ -86,7 +86,7 @@
<script>
import { showError } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
-import { vElementVisibility } from '@vueuse/components'
+import { vElementVisibility as elementVisibility } from '@vueuse/components'
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
@@ -113,7 +113,7 @@ export default {
},
directives: {
- vElementVisibility,
+ elementVisibility,
},
mixins: [CommentView],
@@ -124,7 +124,7 @@ export default {
loading: false,
done: false,
- resourceId: null,
+ currentResourceId: this.resourceId,
offset: 0,
comments: [],
@@ -144,13 +144,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'))
}
@@ -163,7 +169,7 @@ export default {
* @param {number} resourceId the current resourceId (fileId...)
*/
async update(resourceId) {
- this.resourceId = resourceId
+ this.currentResourceId = resourceId
this.resetState()
this.getComments()
},
@@ -202,7 +208,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 })