From f9fb3c3a06b139f6a623594616651c28e99caab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 5 Oct 2023 01:02:39 -0400 Subject: [PATCH] refactor: change private message email subject if roomName is set use it in the subject along wit the sender displayname --- public/language/en-GB/email.json | 4 ++-- src/messaging/notifications.js | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/public/language/en-GB/email.json b/public/language/en-GB/email.json index 8397609e8c..23812bd014 100644 --- a/public/language/en-GB/email.json +++ b/public/language/en-GB/email.json @@ -45,8 +45,8 @@ "digest.title.week": "Your Weekly Digest", "digest.title.month": "Your Monthly Digest", - "notif.chat.subject": "New chat message received in \"%1\"", - "notif.chat.public-chat-subject": "New message from %1 in room %2", + "notif.chat.new-message-from-user": "New message from \"%1\"", + "notif.chat.new-message-from-user-in-room": "New message from %1 in room %2", "notif.chat.cta": "Click here to continue the conversation", "notif.chat.unsub.info": "This chat notification was sent to you due to your subscription settings.", diff --git a/src/messaging/notifications.js b/src/messaging/notifications.js index 084a6c768c..fc3baf2b18 100644 --- a/src/messaging/notifications.js +++ b/src/messaging/notifications.js @@ -105,7 +105,9 @@ module.exports = function (Messaging) { const roomName = roomData.roomName || `[[modules:chat.room-id, ${roomId}]]`; const notifData = { type: isGroupChat ? 'new-group-chat' : 'new-chat', - subject: `[[email:notif.chat.subject, ${roomName}]]`, + subject: roomData.roomName ? + `[[email:notif.chat.new-message-from-user-in-room, ${displayname}, ${roomName}]]` : + `[[email:notif.chat.new-message-from-user, ${displayname}]]`, bodyShort: isGroupChat || roomData.roomName ? `[[notifications:new_message_in, ${roomName}]]` : `[[notifications:new_message_from, ${displayname}]]`, bodyLong: messageObj.content, nid: `chat_${roomId}_${fromUid}_${Date.now()}`, @@ -119,7 +121,7 @@ module.exports = function (Messaging) { const icon = Messaging.getRoomIcon(roomData); notifData.type = 'new-public-chat'; notifData.roomIcon = icon; - notifData.subject = `[[email:notif.chat.public-chat-subject, ${displayname}, ${roomName}]]`; + notifData.subject = `[[email:notif.chat.new-message-from-user-in-room, ${displayname}, ${roomName}]]`; notifData.bodyShort = `[[notifications:user_posted_in_public_room, ${displayname}, ${icon}, ${roomName}]]`; notifData.mergeId = `notifications:user_posted_in_public_room|${roomId}`; }