From 69a08c0f6c01813f2f68ffc478ecdf55722506ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 2 Dec 2024 10:38:21 -0500 Subject: [PATCH] feat: use displayname in chat teasers/userlist, in digest email #12945 --- public/src/client/chats/messages.js | 2 +- src/messaging/index.js | 4 ++-- src/views/emails/digest.tpl | 8 ++++---- src/views/partials/chats/message.tpl | 2 +- src/views/partials/chats/room-teaser.tpl | 2 +- src/views/partials/chats/user-list.tpl | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/public/src/client/chats/messages.js b/public/src/client/chats/messages.js index f1339c7562..8726f78914 100644 --- a/public/src/client/chats/messages.js +++ b/public/src/client/chats/messages.js @@ -181,7 +181,7 @@ define('forum/chats/messages', [ const replyToEl = composerEl.find('[component="chat/composer/replying-to"]'); replyToEl.attr('data-tomid', mid) .find('[component="chat/composer/replying-to-text"]') - .translateText(`[[modules:chat.replying-to, ${msgEl.attr('data-username')}]]`); + .translateText(`[[modules:chat.replying-to, ${msgEl.attr('data-displayname')}]]`); replyToEl.removeClass('hidden'); replyToEl.find('[component="chat/composer/replying-to-cancel"]').off('click') .on('click', () => { diff --git a/src/messaging/index.js b/src/messaging/index.js index eda2bd4ac0..5bcda1c25a 100644 --- a/src/messaging/index.js +++ b/src/messaging/index.js @@ -233,7 +233,7 @@ Messaging.getRecentChats = async (callerUid, uid, start, stop) => { Messaging.generateUsernames = function (room, excludeUid) { const users = room.users.filter(u => u && parseInt(u.uid, 10) !== excludeUid); - const usernames = users.map(u => u.username); + const usernames = users.map(u => u.displayname); if (users.length > 3) { return translator.compile( 'modules:chat.usernames-and-x-others', @@ -246,7 +246,7 @@ Messaging.generateUsernames = function (room, excludeUid) { Messaging.generateChatWithMessage = async function (room, callerUid, userLang) { const users = room.users.filter(u => u && parseInt(u.uid, 10) !== callerUid); - const usernames = users.map(u => `${u.username}`); + const usernames = users.map(u => `${u.displayname}`); let compiled = ''; if (!users.length) { return '[[modules:chat.no-users-in-room]]'; diff --git a/src/views/emails/digest.tpl b/src/views/emails/digest.tpl index 849c112b7e..3cc21af00a 100644 --- a/src/views/emails/digest.tpl +++ b/src/views/emails/digest.tpl @@ -9,7 +9,7 @@ @@ -75,7 +75,7 @@ @@ -110,7 +110,7 @@ @@ -145,7 +145,7 @@ diff --git a/src/views/partials/chats/message.tpl b/src/views/partials/chats/message.tpl index 527a055f17..3d2e0ce122 100644 --- a/src/views/partials/chats/message.tpl +++ b/src/views/partials/chats/message.tpl @@ -1,4 +1,4 @@ -
  • +
  • {{{ if messages.parent }}} diff --git a/src/views/partials/chats/room-teaser.tpl b/src/views/partials/chats/room-teaser.tpl index ae7f53f251..ee5aa856d8 100644 --- a/src/views/partials/chats/room-teaser.tpl +++ b/src/views/partials/chats/room-teaser.tpl @@ -2,7 +2,7 @@ {{{ if ./teaser }}}
    {buildAvatar(./teaser.user, "14px", true, "align-middle")} - {./teaser.user.username}: + {./teaser.user.displayname}: {./teaser.content}
    {{{ if ./teaser.timeagoLong }}}{./teaser.timeagoLong}{{{ else }}}{{{ end }}}
    diff --git a/src/views/partials/chats/user-list.tpl b/src/views/partials/chats/user-list.tpl index 306a625290..5825ab7874 100644 --- a/src/views/partials/chats/user-list.tpl +++ b/src/views/partials/chats/user-list.tpl @@ -3,7 +3,7 @@
    {buildAvatar(users, "24px", true)}
    - {./username} + {./displayname} {{{ if ./isOwner }}}{{{ end }}}
  • -

    [[email:greeting-with-name, {username}]]

    +

    [[email:greeting-with-name, {displayname}]]

    {function.renderDigestAvatar}

    {topTopics.title}

    -

    {topTopics.teaser.user.username}

    +

    {topTopics.teaser.user.displayname}

    {function.renderDigestAvatar}

    {popularTopics.title}

    -

    {popularTopics.teaser.user.username}

    +

    {popularTopics.teaser.user.displayname}

    {function.renderDigestAvatar}

    {recent.title}

    -

    {recent.teaser.user.username}

    +

    {recent.teaser.user.displayname}