Implement Require Email for Notifications on Frontend

This commit is contained in:
Chi Vinh Le
2018-03-05 17:12:05 +01:00
parent 8113c4f8b8
commit 047beb1ae9
17 changed files with 312 additions and 10 deletions
@@ -31,6 +31,12 @@ class SettingsContainer extends React.Component {
this.props.updateNotificationSettings(this.state.turnOffInput);
};
getNeedEmailVerification() {
return !this.props.root.me.profiles.some(
profile => profile.provider === 'local' && profile.confirmedAt
);
}
render() {
return (
<Settings
@@ -42,6 +48,8 @@ class SettingsContainer extends React.Component {
updateNotificationSettings={this.props.updateNotificationSettings}
turnOffAll={this.turnOffAll}
turnOffButtonDisabled={this.state.hasNotifications.length === 0}
needEmailVerification={this.getNeedEmailVerification()}
email={this.props.root.me.email}
/>
);
}
@@ -60,6 +68,7 @@ const enhance = compose(
__typename
${getSlotFragmentSpreads(slots, 'root')}
me {
email
profiles {
provider
... on LocalUserProfile {