From ee8a027b4c78fe3239d1bce30d49a1519b0ab81f Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 21 Feb 2019 15:18:11 -0700 Subject: [PATCH 1/2] Fix toggle for email notifications The function doesn't receive an event, it receives a boolean. Fixes https://github.com/vector-im/riot-web/issues/8837 --- src/components/views/settings/Notifications.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index 03bb4765ed..3b6321dc6f 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -132,9 +132,9 @@ module.exports = React.createClass({ }); }, - onEnableEmailNotificationsChange: function(address, event) { + onEnableEmailNotificationsChange: function(address, checked) { let emailPusherPromise; - if (event.target.checked) { + if (checked) { const data = {}; data['brand'] = SdkConfig.get().brand || 'Riot'; emailPusherPromise = UserSettingsStore.addEmailPusher(address, data); From 23dd3573f813ac95552e4be052771962527705b3 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 21 Feb 2019 15:18:54 -0700 Subject: [PATCH 2/2] Fix SdkConfig import in Notifications Fixes an issue discovered after fixing the toggle - The SdkConfig in onEnableEmailNotificationsChange ends up being undefined if the import is left as-is. --- src/components/views/settings/Notifications.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index 3b6321dc6f..42c981fa03 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -28,7 +28,7 @@ import { PushRuleVectorState, ContentRules, } from '../../../notifications'; -import * as SdkConfig from "../../../SdkConfig"; +import SdkConfig from "../../../SdkConfig"; import LabelledToggleSwitch from "../elements/LabelledToggleSwitch"; // TODO: this "view" component still has far too much application logic in it,