Skip to content

Commit b469840

Browse files
Merge pull request #55645 from nextcloud/bugfix/noid/comments-by-apps
Fix comments when used by other apps
2 parents 3efb030 + 4efb40f commit b469840

File tree

9 files changed

+23
-14
lines changed

9 files changed

+23
-14
lines changed

apps/comments/lib/Collaboration/CommentersSorter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public function getId(): string {
2727
* @param array $context
2828
*/
2929
public function sort(array &$sortArray, array $context): void {
30+
if (!isset($context['itemType'], $context['itemId'])) {
31+
return;
32+
}
33+
3034
$commenters = $this->retrieveCommentsInformation($context['itemType'], $context['itemId']);
3135
if (count($commenters) === 0) {
3236
return;

apps/comments/src/mixins/CommentView.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default defineComponent({
2727
key: 'editor',
2828
},
2929
userData: {},
30+
currentResourceId: this.resourceId,
3031
}
3132
},
3233
methods: {
@@ -40,8 +41,8 @@ export default defineComponent({
4041
const { data } = await axios.get(generateOcsUrl('core/autocomplete/get'), {
4142
params: {
4243
search,
43-
itemType: 'files',
44-
itemId: this.resourceId,
44+
itemType: this.resourceType,
45+
itemId: this.currentResourceId,
4546
sorter: 'commenters|share-recipients',
4647
limit: loadState('comments', 'maxAutoCompleteResults'),
4748
},

apps/comments/src/views/Comments.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ export default {
110110
loading: false,
111111
done: false,
112112
113-
currentResourceId: this.resourceId,
114113
offset: 0,
115114
comments: [],
116115
@@ -158,7 +157,7 @@ export default {
158157
async update(resourceId) {
159158
this.currentResourceId = resourceId
160159
this.resetState()
161-
this.getComments()
160+
await this.getComments()
162161
},
163162
164163
/**
@@ -206,8 +205,13 @@ export default {
206205
this.done = true
207206
}
208207
208+
// Ensure actor id is a string
209+
for (const comment of comments) {
210+
comment.props.actorId = comment.props.actorId.toString()
211+
}
212+
209213
// Insert results
210-
this.comments.push(...comments)
214+
this.comments = [...this.comments, ...comments]
211215
212216
// Increase offset for next fetch
213217
this.offset += DEFAULT_LIMIT

dist/7462-7462.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/7462-7462.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/comments-comments-app.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/comments-comments-app.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/comments-comments-tab.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/comments-comments-tab.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)