Skip to content

Commit

Permalink
PATCH: Skip Offline Email Notification for the IG Welcome Chat
Browse files Browse the repository at this point in the history
SAPI will set `customFields.skip_offline_email_notification`
on Welcome Chat DMs
  • Loading branch information
nmagedman committed Jul 1, 2024
1 parent 2c3df52 commit 7b34fbf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/meteor/app/lib/server/functions/notifications/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,18 @@ export function shouldNotifyEmail({
hasReplyToThread,
roomType,
isThread,
message,
}) {
// email notifications are disabled globally
if (!settings.get('Accounts_AllowEmailNotifications')) {
return false;
}

// Support special-casing specific messages
if (message.customFields?.skip_offline_email_notification) {
return false;
}

// user/room preference to nothing
if (emailNotifications === 'nothing') {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export const sendNotification = async ({
hasReplyToThread,
roomType,
isThread,
message,
})
) {
const messageWithUnicode = message.msg ? emojione.shortnameToUnicode(message.msg) : message.msg;
Expand Down

0 comments on commit 7b34fbf

Please sign in to comment.