Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/green-timers-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

notification emails should now show emojis properly
14 changes: 13 additions & 1 deletion apps/meteor/app/lib/server/lib/sendNotificationsOnMessage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Subscriptions, Users } from '@rocket.chat/models';
import emojione from 'emojione';
import moment from 'moment';

import { callbacks } from '../../../../lib/callbacks';
Expand Down Expand Up @@ -145,12 +146,23 @@ export const sendNotification = async ({
isThread,
})
) {
const messageWithUnicode = message.msg ? emojione.shortnameToUnicode(message.msg) : message.msg;
const firstAttachment = message.attachments?.length > 0 && message.attachments.shift();
firstAttachment.description =
typeof firstAttachment.description === 'string' ? emojione.shortnameToUnicode(firstAttachment.description) : undefined;
firstAttachment.text = typeof firstAttachment.text === 'string' ? emojione.shortnameToUnicode(firstAttachment.text) : undefined;

const attachments = firstAttachment ? [firstAttachment, ...message.attachments].filter(Boolean) : [];
for await (const email of receiver.emails) {
if (email.verified) {
queueItems.push({
type: 'email',
data: await getEmailData({
message,
message: {
...message,
msg: messageWithUnicode,
...(attachments.length > 0 ? { attachments } : {}),
},
receiver,
sender,
subscription,
Expand Down