-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#169703944] check isEmailValidated / isEmailEnabled flags before sending email #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,8 +154,12 @@ export const getCreateNotificationActivityHandler = ( | |
|
||
// whether email notifications are enabled in this user profile - this is | ||
// true by default, it's false only for users that have isEmailEnabled = false | ||
// in their profile | ||
const isEmailEnabledInProfile = profile.isEmailEnabled; | ||
// in their profile. We assume it's true when not defined in user's profile. | ||
const isEmailEnabledInProfile = profile.isEmailEnabled !== false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. true when undefined |
||
|
||
// Check if the email in the user profile is validated. | ||
// we assume it's true when not defined in user's profile. | ||
const isEmailValidatedInProfile = profile.isEmailValidated !== false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gunzip Could you confirm the field There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this fix regards existing (SPID) users that never had this field set up (so it's undefined in their profile) |
||
|
||
// first we check whether the user has blocked emails notifications for the | ||
// service that is sending the message | ||
|
@@ -172,12 +176,14 @@ export const getCreateNotificationActivityHandler = ( | |
// we send an email notification when all the following conditions are met: | ||
// | ||
// * email notifications are enabled in the user profile (isEmailEnabledInProfile) | ||
// * email is validated in the user profile (isEmailValidatedInProfile) | ||
// * email notifications are not blocked for the sender service (!isEmailBlockedForService) | ||
// * the sender service allows email channel | ||
// * a destination email address is configured (maybeEmailFromProfile) | ||
// | ||
const maybeEmailNotificationAddress = | ||
isEmailEnabledInProfile && | ||
isEmailValidatedInProfile && | ||
!isEmailBlockedForService && | ||
isEmailChannelAllowed | ||
? maybeEmailFromProfile | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false when undefined