diff --git a/app/lib/lib/roomTypes/direct.js b/app/lib/lib/roomTypes/direct.js index b564d3e3e012..487c21d63891 100644 --- a/app/lib/lib/roomTypes/direct.js +++ b/app/lib/lib/roomTypes/direct.js @@ -167,10 +167,17 @@ export class DirectMessageRoomType extends RoomTypeConfig { return {}; } - const title = settings.get('UI_Use_Real_Name') ? user.name : `@${ user.username }`; - const text = notificationMessage; + if (this.isGroupChat(room)) { + return { + title: this.roomName(room), + text: `${ (settings.get('UI_Use_Real_Name') && user.name) || user.username }: ${ notificationMessage }`, + }; + } - return { title, text }; + return { + title: (settings.get('UI_Use_Real_Name') && user.name) || user.username, + text: notificationMessage, + }; } getAvatarPath(roomData, subData) { diff --git a/app/lib/server/functions/notifications/email.js b/app/lib/server/functions/notifications/email.js index 0b22255842ec..13a4652072d3 100644 --- a/app/lib/server/functions/notifications/email.js +++ b/app/lib/server/functions/notifications/email.js @@ -26,7 +26,9 @@ function getEmailContent({ message, user, room }) { const roomName = s.escapeHTML(`#${ roomTypes.getRoomName(room.t, room) }`); const userName = s.escapeHTML(settings.get('UI_Use_Real_Name') ? message.u.name || message.u.username : message.u.username); - const header = TAPi18n.__(room.t === 'd' ? 'User_sent_a_message_to_you' : 'User_sent_a_message_on_channel', { + const roomType = roomTypes.getConfig(room.t); + + const header = TAPi18n.__(!roomType.isGroupChat(room) ? 'User_sent_a_message_to_you' : 'User_sent_a_message_on_channel', { username: userName, channel: roomName, lng, @@ -54,7 +56,7 @@ function getEmailContent({ message, user, room }) { } if (message.file) { - const fileHeader = TAPi18n.__(room.t === 'd' ? 'User_uploaded_a_file_to_you' : 'User_uploaded_a_file_on_channel', { + const fileHeader = TAPi18n.__(!roomType.isGroupChat(room) ? 'User_uploaded_a_file_to_you' : 'User_uploaded_a_file_on_channel', { username: userName, channel: roomName, lng, @@ -112,7 +114,7 @@ export function sendEmail({ message, user, subscription, room, emailAddress, has const username = settings.get('UI_Use_Real_Name') ? message.u.name || message.u.username : message.u.username; let subjectKey = 'Offline_Mention_All_Email'; - if (room.t === 'd') { + if (!roomTypes.getConfig(room.t).isGroupChat(room)) { subjectKey = 'Offline_DM_Email'; } else if (hasMentionToUser) { subjectKey = 'Offline_Mention_Email'; diff --git a/app/lib/server/functions/notifications/mobile.js b/app/lib/server/functions/notifications/mobile.js index fef2c83ba2b5..1e7a5d54849d 100644 --- a/app/lib/server/functions/notifications/mobile.js +++ b/app/lib/server/functions/notifications/mobile.js @@ -63,7 +63,7 @@ export async function sendSinglePush({ room, message, userId, receiverUsername, messageType: message.t, messageId: message._id, }, - roomName: settings.get('Push_show_username_room') && room.t !== 'd' ? `#${ roomTypes.getRoomName(room.t, room) }` : '', + roomName: settings.get('Push_show_username_room') && roomTypes.getConfig(room.t).isGroupChat(room) ? `#${ roomTypes.getRoomName(room.t, room) }` : '', username, message: settings.get('Push_show_message') ? notificationMessage : ' ', badge: await getBadgeCount(userId),