Skip to content

Commit

Permalink
refactor: change private message email subject
Browse files Browse the repository at this point in the history
if roomName is set use it in the subject along wit the sender displayname
  • Loading branch information
barisusakli committed Oct 5, 2023
1 parent cddfdae commit f9fb3c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions public/language/en-GB/email.json
Expand Up @@ -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.",

Expand Down
6 changes: 4 additions & 2 deletions src/messaging/notifications.js
Expand Up @@ -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()}`,
Expand All @@ -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}`;
}
Expand Down

0 comments on commit f9fb3c3

Please sign in to comment.