From abb170ebde9144cd05dad13e36c97e1743806988 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 23 Dec 2015 17:06:30 +0000 Subject: [PATCH] Keep one source of truth (the Notifier) when toggling notification state. Fixes notifications. --- src/components/structures/UserSettings.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index cef15dff5d..da61f62114 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -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({