-
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #32 +/- ##
=======================================
Coverage 83.97% 83.97%
=======================================
Files 6 6
Lines 337 337
Branches 43 43
=======================================
Hits 283 283
Misses 53 53
Partials 1 1 Continue to review full report at Codecov.
|
@@ -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; |
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
// 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
@gunzip Could you confirm the field isEmailValidated
is set to false on CIE first authentication?
Because this assumption is valid only for SPID users
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.
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.
this fix regards existing (SPID) users that never had this field set up (so it's undefined in their profile)
Since not every user profile stored into CosmosDB has email flags defined (so they are neither true nor false), we use strict equality and assume
isEmailEnabled = true
andisEmailValidated = true
when they're undefined.