Merge branch 'master' into hackday-upvote-downvote-ama

This commit is contained in:
Belén Curcio
2018-03-21 16:12:05 -03:00
committed by GitHub
4 changed files with 41 additions and 8 deletions
@@ -16,6 +16,7 @@ anything. You need to enable one of the `talk-plugin-notifications-category-*` p
Configuration:
- `DISABLE_REQUIRE_EMAIL_VERIFICATIONS` - When `TRUE`, it will disable the verification email check before sending notifications for those emails. **Note that organizations implementing a custom authentication system _must_ disable this feature, as they don't use our integrated auth**. (Default `FALSE`).
- `TALK_CLIENT_FORCE_NOTIFICATION_SETTINGS` - When `TRUE`, the settings pane for notifications will show always, even if the user does not have a `local` profile. (Default `FALSE`).
You can enable other notification options by adding more
`talk-plugin-notification-*` plugins!
@@ -9,6 +9,8 @@ import {
} from 'plugin-api/beta/client/hocs';
import { getSlotFragmentSpreads } from 'plugin-api/beta/client/utils';
import { withUpdateNotificationSettings } from '../mutations';
import { connect } from 'plugin-api/beta/client/hocs';
import { staticConfigSelector } from 'plugin-api/beta/client/selectors';
const slots = ['notificationSettings'];
@@ -42,8 +44,11 @@ class SettingsContainer extends React.Component {
};
getNeedEmailVerification() {
return !this.props.root.me.profiles.some(
profile => profile.provider === 'local' && profile.confirmedAt
return (
this.props.root.settings.notificationsRequireConfirmation &&
!this.props.root.me.profiles.some(
profile => profile.provider === 'local' && profile.confirmedAt
)
);
}
@@ -94,11 +99,22 @@ const enhance = compose(
}
}
}
settings {
notificationsRequireConfirmation
}
}
`,
}),
// Grab the static configuration from the redux store.
connect(state => ({
static: staticConfigSelector(state),
})),
excludeIf(
props =>
// If the environment variable for TALK_CLIENT_FORCE_NOTIFICATION_SETTINGS
// is `TRUE`, then always show it.
props.static.TALK_CLIENT_FORCE_NOTIFICATION_SETTINGS !== 'TRUE' &&
// Only show the settings pane if we have a local profile otherwise.
!props.root.me.profiles.some(profile => profile.provider === 'local')
),
withUpdateNotificationSettings,