Skip to content

Commit 6a1172e

Browse files
fix: mentioning federated user in card comment
Signed-off-by: Luka Trovic <luka@nextcloud.com>
1 parent b17dd13 commit 6a1172e

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

lib/Service/CommentService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private function formatComment(IComment $comment, bool $addReplyTo = false): arr
177177
} catch (OutOfBoundsException $e) {
178178
$this->logger->warning('Mention type not registered, can not resolve display name.', ['exception' => $e, 'mention_type' => $mention['type']]);
179179
// No display name, upon client's discretion what to display.
180-
$displayName = '';
180+
$displayName = $mention['id'] ?? '';
181181
}
182182

183183
return [

src/components/card/CommentForm.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ export default {
5858
members() {
5959
const obj = {}
6060
this.currentBoard.users.forEach(user => {
61-
obj[user.uid] = {
61+
obj[user.remote ? `federated_user/${user.uid}` : user.uid] = {
6262
icon: 'icon-user',
63-
id: user.uid,
64-
label: user.displayname,
65-
source: 'users',
63+
id: user.remote ? `federated_user/${user.uid}` : user.uid,
64+
label: user.remote ? user.uid : user.displayname,
65+
source: user.remote ? 'federated_user' : 'users',
6666
}
6767
})
6868
return obj

src/components/card/CommentItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ export default {
152152
comment.mentions.forEach((mention, index) => {
153153
// Currently only [a-z\-_0-9] are allowed inside of placeholders so we use a hash of the mention id as a unique identifier
154154
const hash = md5(mention.mentionId)
155+
message = message.replace('federated_user/', '')
155156
message = message.split('@' + mention.mentionId + '').join(`{user-${hash}}`)
156157
message = message.split('@"' + mention.mentionId + '"').join(`{user-${hash}}`)
157-
158158
})
159159
return message
160160
}
@@ -167,7 +167,7 @@ export default {
167167
result[itemKey] = {
168168
component: AtMention,
169169
props: {
170-
user: item.mentionId,
170+
user: (item.mentionType === 'federated_user' ? 'federated_user/' : '') + item.mentionId,
171171
displayName: item.mentionDisplayName,
172172
},
173173
}

0 commit comments

Comments
 (0)