Keep one source of truth (the Notifier) when toggling notification state. Fixes notifications.
This commit is contained in:
parent
a279dce027
commit
abb170ebde
1 changed files with 3 additions and 10 deletions
|
@ -46,7 +46,6 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this._refreshFromServer();
|
this._refreshFromServer();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -80,9 +79,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
onAction: function(payload) {
|
onAction: function(payload) {
|
||||||
if (payload.action === "notifier_enabled") {
|
if (payload.action === "notifier_enabled") {
|
||||||
this.setState({
|
this.forceUpdate();
|
||||||
enableNotifications : UserSettingsStore.getEnableNotifications()
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -143,11 +140,7 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onEnableNotificationsChange: function(event) {
|
onEnableNotificationsChange: function(event) {
|
||||||
// don't bother waiting for Save to be clicked, as that'd be silly
|
UserSettingsStore.setEnableNotifications(event.target.checked);
|
||||||
UserSettingsStore.setEnableNotifications( this.refs.enableNotifications.value );
|
|
||||||
this.setState({
|
|
||||||
enableNotifications : UserSettingsStore.getEnableNotifications()
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
@ -245,7 +238,7 @@ module.exports = React.createClass({
|
||||||
<input id="enableNotifications"
|
<input id="enableNotifications"
|
||||||
ref="enableNotifications"
|
ref="enableNotifications"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={ this.state.enableNotifications }
|
checked={ UserSettingsStore.getEnableNotifications() }
|
||||||
onChange={ this.onEnableNotificationsChange } />
|
onChange={ this.onEnableNotificationsChange } />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_UserSettings_notifLabelCell">
|
<div className="mx_UserSettings_notifLabelCell">
|
||||||
|
|
Loading…
Reference in a new issue