You've already forked matrix-react-sdk
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:
@@ -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">
|
||||||
|
|||||||
Reference in New Issue
Block a user