From c6a09b4d5a4d8e6aedaa530b2a0e04b34c33b586 Mon Sep 17 00:00:00 2001 From: DorraJaouad Date: Thu, 5 Oct 2023 20:05:01 +0200 Subject: [PATCH 1/2] Fix mention handling to also add multi-words id and convert at-all mention to bold display name. Signed-off-by: DorraJaouad --- src/store/messagesStore.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/store/messagesStore.js b/src/store/messagesStore.js index 6dac72083d6..b38bc5204ff 100644 --- a/src/store/messagesStore.js +++ b/src/store/messagesStore.js @@ -1306,7 +1306,8 @@ const actions = { for (const key in message.messageParameters) { if (key.startsWith('mention')) { const mention = message.messageParameters[key] - message.message = message.message.replace(`{${key}}`, `@${mention.name}`) + const mentionString = key.includes('mention-call') ? `**${mention.name}**` : `@"${mention.id}"` + message.message = message.message.replace(`{${key}}`, mentionString) } } From edc78787fbe0429017e4bc9c7e1fd39b1593570f Mon Sep 17 00:00:00 2001 From: DorraJaouad Date: Thu, 5 Oct 2023 20:28:47 +0200 Subject: [PATCH 2/2] Adjust test Signed-off-by: DorraJaouad --- src/store/messagesStore.spec.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/store/messagesStore.spec.js b/src/store/messagesStore.spec.js index 44e00ba2b99..5519670131f 100644 --- a/src/store/messagesStore.spec.js +++ b/src/store/messagesStore.spec.js @@ -1935,7 +1935,7 @@ describe('messagesStore', () => { messageToBeForwarded = { id: 1, token: TOKEN, - message: 'Hello {mention-user1}, {mention-user2}', + message: 'Hello {mention-user1}, {mention-user2}, and {mention-call1}', messageParameters: { 'mention-user1': { id: 'taylor', @@ -1943,15 +1943,20 @@ describe('messagesStore', () => { type: 'user', }, 'mention-user2': { - id: 'adam', + id: 'adam driver', name: 'Adam', type: 'user', }, + 'mention-call1': { + id: TOKEN, + name: 'Team X', + type: 'call', + }, }, } targetToken = 'token-2' messageExpected = cloneDeep(messageToBeForwarded) - messageExpected.message = 'Hello @Taylor, @Adam' + messageExpected.message = 'Hello @"taylor", @"adam driver", and **Team X**' messageExpected.token = targetToken // Act