From 954d49f22e291d3ab32da3d0da3123dcd495215b Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Thu, 11 Oct 2018 22:04:53 -0500 Subject: [PATCH] Fix lint errors in ContentRules.js Signed-off-by: Aaron Raimist --- src/notifications/ContentRules.js | 33 +++++++++++++------------------ 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/notifications/ContentRules.js b/src/notifications/ContentRules.js index 25a7bac96e..f7e722dbfe 100644 --- a/src/notifications/ContentRules.js +++ b/src/notifications/ContentRules.js @@ -16,7 +16,7 @@ limitations under the License. 'use strict'; -var PushRuleVectorState = require('./PushRuleVectorState'); +const PushRuleVectorState = require('./PushRuleVectorState'); module.exports = { /** @@ -32,7 +32,7 @@ module.exports = { */ parseContentRules: function(rulesets) { // first categorise the keyword rules in terms of their actions - var contentRules = this._categoriseContentRules(rulesets); + const contentRules = this._categoriseContentRules(rulesets); // Decide which content rules to display in Vector UI. // Vector displays a single global rule for a list of keywords @@ -54,41 +54,38 @@ module.exports = { rules: contentRules.loud, externalRules: [].concat(contentRules.loud_but_disabled, contentRules.on, contentRules.on_but_disabled, contentRules.other), }; - } - else if (contentRules.loud_but_disabled.length) { + } else if (contentRules.loud_but_disabled.length) { return { vectorState: PushRuleVectorState.OFF, rules: contentRules.loud_but_disabled, externalRules: [].concat(contentRules.on, contentRules.on_but_disabled, contentRules.other), }; - } - else if (contentRules.on.length) { + } else if (contentRules.on.length) { return { vectorState: PushRuleVectorState.ON, rules: contentRules.on, externalRules: [].concat(contentRules.on_but_disabled, contentRules.other), }; - } - else if (contentRules.on_but_disabled.length) { + } else if (contentRules.on_but_disabled.length) { return { vectorState: PushRuleVectorState.OFF, rules: contentRules.on_but_disabled, externalRules: contentRules.other, - } - } else { + }; + } else { return { vectorState: PushRuleVectorState.ON, rules: [], externalRules: contentRules.other, - } + }; } }, _categoriseContentRules: function(rulesets) { - var contentRules = {on: [], on_but_disabled:[], loud: [], loud_but_disabled: [], other: []}; - for (var kind in rulesets.global) { - for (var i = 0; i < Object.keys(rulesets.global[kind]).length; ++i) { - var r = rulesets.global[kind][i]; + const contentRules = {on: [], on_but_disabled: [], loud: [], loud_but_disabled: [], other: []}; + for (const kind in rulesets.global) { + for (let i = 0; i < Object.keys(rulesets.global[kind]).length; ++i) { + const r = rulesets.global[kind][i]; // check it's not a default rule if (r.rule_id[0] === '.' || kind !== 'content') { @@ -101,16 +98,14 @@ module.exports = { case PushRuleVectorState.ON: if (r.enabled) { contentRules.on.push(r); - } - else { + } else { contentRules.on_but_disabled.push(r); } break; case PushRuleVectorState.LOUD: if (r.enabled) { contentRules.loud.push(r); - } - else { + } else { contentRules.loud_but_disabled.push(r); } break;