From 5450223cc76f75c5e0dda75f46427f5117f75695 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 14 Apr 2016 22:31:40 +0100 Subject: [PATCH] More notifications fixes Fix another thing I broke during the refactor --- .../views/settings/Notifications.js | 4 ++-- src/notifications/PushRuleVectorState.js | 21 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index aec14e6e2..01d7e70b5 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -497,8 +497,8 @@ module.exports = React.createClass({ // Translate the rule actions and its enabled value into vector state var vectorState; if (rule) { - for (var stateKey in PushRuleVectorState) { - var state = PushRuleVectorState[stateKey]; + for (var stateKey in PushRuleVectorState.states) { + var state = PushRuleVectorState.states[stateKey]; var vectorStateToActions = ruleDefinition.vectorStateToActions[state]; if (!vectorStateToActions) { diff --git a/src/notifications/PushRuleVectorState.js b/src/notifications/PushRuleVectorState.js index 019ce8a93..67f9a3c09 100644 --- a/src/notifications/PushRuleVectorState.js +++ b/src/notifications/PushRuleVectorState.js @@ -18,12 +18,7 @@ limitations under the License. var StandardActions = require('./StandardActions'); -/** - * Enum for state of a push rule as defined by the Vector UI. - * @readonly - * @enum {string} - */ -module.exports = { +var states = { /** The push rule is disabled */ OFF: "off", @@ -33,6 +28,16 @@ module.exports = { /** The user will receive push notification for this rule with sound and highlight if this is legitimate */ LOUD: "loud", +}; + + +module.exports = { + /** + * Enum for state of a push rule as defined by the Vector UI. + * @readonly + * @enum {string} + */ + states: states, /** * Convert a PushRuleVectorState to a list of actions @@ -78,3 +83,7 @@ module.exports = { return stateKind; }, }; + +for (var k in states) { + module.exports[k] = states[k]; +};