diff --git a/test/api/unit/libs/slack.js b/test/api/unit/libs/slack.js index 58cbab04f3..4b6acdf695 100644 --- a/test/api/unit/libs/slack.js +++ b/test/api/unit/libs/slack.js @@ -32,6 +32,7 @@ describe('slack', () => { }, message: { id: 'chat-id', + username: 'author', user: 'Author', uuid: 'author-id', text: 'some text', @@ -54,7 +55,7 @@ describe('slack', () => { attachments: [{ fallback: 'Flag Message', color: 'danger', - author_name: `Author - author@example.com - author-id\n${timestamp}`, + author_name: `@author Author (author@example.com; author-id)\n${timestamp}`, title: 'Flag in Some group - (private guild)', title_link: undefined, text: 'some text', diff --git a/test/api/v3/integration/chat/POST-chat.flag.test.js b/test/api/v3/integration/chat/POST-chat.flag.test.js index d93c199c63..723715c80b 100644 --- a/test/api/v3/integration/chat/POST-chat.flag.test.js +++ b/test/api/v3/integration/chat/POST-chat.flag.test.js @@ -67,7 +67,7 @@ describe('POST /chat/:chatId/flag', () => { attachments: [{ fallback: 'Flag Message', color: 'danger', - author_name: `${anotherUser.profile.name} - ${anotherUser.auth.local.email} - ${anotherUser._id}\n${timestamp}`, + author_name: `@${anotherUser.auth.local.username} ${anotherUser.profile.name} (${anotherUser.auth.local.email}; ${anotherUser._id})\n${timestamp}`, title: 'Flag in Test Guild', title_link: `${BASE_URL}/groups/guild/${group._id}`, text: TEST_MESSAGE, @@ -102,7 +102,7 @@ describe('POST /chat/:chatId/flag', () => { attachments: [{ fallback: 'Flag Message', color: 'danger', - author_name: `${newUser.profile.name} - ${newUser.auth.local.email} - ${newUser._id}\n${timestamp}`, + author_name: `@${newUser.auth.local.username} ${newUser.profile.name} (${newUser.auth.local.email}; ${newUser._id})\n${timestamp}`, title: 'Flag in Test Guild', title_link: `${BASE_URL}/groups/guild/${group._id}`, text: TEST_MESSAGE, diff --git a/website/server/libs/slack.js b/website/server/libs/slack.js index f0807ce970..0adaf24894 100644 --- a/website/server/libs/slack.js +++ b/website/server/libs/slack.js @@ -41,7 +41,7 @@ try { * @returns {string} */ function formatUser (formatObj) { - return `@${formatObj.name} ${formatObj.displayName} (${formatObj.email}; ${formatObj.uuid}`; + return `@${formatObj.name} ${formatObj.displayName} (${formatObj.email}; ${formatObj.uuid})`; } function sendFlagNotification ({