1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-08 21:42:24 +03:00

Keep one source of truth (the Notifier) when toggling notification state. Fixes notifications.

This commit is contained in:
Kegan Dougal
2015-12-23 17:06:30 +00:00
parent a279dce027
commit abb170ebde

View File

@@ -46,7 +46,6 @@ module.exports = React.createClass({
componentWillMount: function() {
var self = this;
this._refreshFromServer();
},
@@ -80,9 +79,7 @@ module.exports = React.createClass({
onAction: function(payload) {
if (payload.action === "notifier_enabled") {
this.setState({
enableNotifications : UserSettingsStore.getEnableNotifications()
});
this.forceUpdate();
}
},
@@ -143,11 +140,7 @@ module.exports = React.createClass({
},
onEnableNotificationsChange: function(event) {
// don't bother waiting for Save to be clicked, as that'd be silly
UserSettingsStore.setEnableNotifications( this.refs.enableNotifications.value );
this.setState({
enableNotifications : UserSettingsStore.getEnableNotifications()
});
UserSettingsStore.setEnableNotifications(event.target.checked);
},
render: function() {
@@ -245,7 +238,7 @@ module.exports = React.createClass({
<input id="enableNotifications"
ref="enableNotifications"
type="checkbox"
checked={ this.state.enableNotifications }
checked={ UserSettingsStore.getEnableNotifications() }
onChange={ this.onEnableNotificationsChange } />
</div>
<div className="mx_UserSettings_notifLabelCell">