Fix lint errors in VectorPushRulesDefinitions.js

Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
Aaron Raimist 2018-10-11 21:59:17 -05:00
parent c83521bb31
commit 6d8649855a
No known key found for this signature in database
GPG key ID: 37419210002890EF

View file

@ -18,8 +18,8 @@ limitations under the License.
import { _td } from '../languageHandler'; import { _td } from '../languageHandler';
var StandardActions = require('./StandardActions'); const StandardActions = require('./StandardActions');
var PushRuleVectorState = require('./PushRuleVectorState'); const PushRuleVectorState = require('./PushRuleVectorState');
class VectorPushRuleDefinition { class VectorPushRuleDefinition {
constructor(opts) { constructor(opts) {
@ -30,16 +30,16 @@ class VectorPushRuleDefinition {
// Translate the rule actions and its enabled value into vector state // Translate the rule actions and its enabled value into vector state
ruleToVectorState(rule) { ruleToVectorState(rule) {
var enabled = false; let enabled = false;
var actions = null; let actions = null;
if (rule) { if (rule) {
enabled = rule.enabled; enabled = rule.enabled;
actions = rule.actions; actions = rule.actions;
} }
for (var stateKey in PushRuleVectorState.states) { for (const stateKey in PushRuleVectorState.states) {
var state = PushRuleVectorState.states[stateKey]; const state = PushRuleVectorState.states[stateKey];
var vectorStateToActions = this.vectorStateToActions[state]; const vectorStateToActions = this.vectorStateToActions[state];
if (!vectorStateToActions) { if (!vectorStateToActions) {
// No defined actions means that this vector state expects a disabled (or absent) rule // No defined actions means that this vector state expects a disabled (or absent) rule
@ -58,7 +58,7 @@ class VectorPushRuleDefinition {
JSON.stringify(rule)); JSON.stringify(rule));
return undefined; return undefined;
} }
}; }
/** /**
* The descriptions of rules managed by the Vector UI. * The descriptions of rules managed by the Vector UI.
@ -71,8 +71,8 @@ module.exports = {
vectorStateToActions: { // The actions for each vector state, or null to disable the rule. vectorStateToActions: { // The actions for each vector state, or null to disable the rule.
on: StandardActions.ACTION_NOTIFY, on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND, loud: StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND,
off: StandardActions.ACTION_DISABLED off: StandardActions.ACTION_DISABLED,
} },
}), }),
// Messages containing user's username (localpart/MXID) // Messages containing user's username (localpart/MXID)
@ -82,8 +82,8 @@ module.exports = {
vectorStateToActions: { // The actions for each vector state, or null to disable the rule. vectorStateToActions: { // The actions for each vector state, or null to disable the rule.
on: StandardActions.ACTION_NOTIFY, on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND, loud: StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND,
off: StandardActions.ACTION_DISABLED off: StandardActions.ACTION_DISABLED,
} },
}), }),
// Messages just sent to the user in a 1:1 room // Messages just sent to the user in a 1:1 room
@ -93,8 +93,8 @@ module.exports = {
vectorStateToActions: { vectorStateToActions: {
on: StandardActions.ACTION_NOTIFY, on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND, loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
off: StandardActions.ACTION_DONT_NOTIFY off: StandardActions.ACTION_DONT_NOTIFY,
} },
}), }),
// Messages just sent to a group chat room // Messages just sent to a group chat room
@ -106,8 +106,8 @@ module.exports = {
vectorStateToActions: { vectorStateToActions: {
on: StandardActions.ACTION_NOTIFY, on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND, loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
off: StandardActions.ACTION_DONT_NOTIFY off: StandardActions.ACTION_DONT_NOTIFY,
} },
}), }),
// Invitation for the user // Invitation for the user
@ -117,8 +117,8 @@ module.exports = {
vectorStateToActions: { vectorStateToActions: {
on: StandardActions.ACTION_NOTIFY, on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND, loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
off: StandardActions.ACTION_DISABLED off: StandardActions.ACTION_DISABLED,
} },
}), }),
// Incoming call // Incoming call
@ -128,8 +128,8 @@ module.exports = {
vectorStateToActions: { vectorStateToActions: {
on: StandardActions.ACTION_NOTIFY, on: StandardActions.ACTION_NOTIFY,
loud: StandardActions.ACTION_NOTIFY_RING_SOUND, loud: StandardActions.ACTION_NOTIFY_RING_SOUND,
off: StandardActions.ACTION_DISABLED off: StandardActions.ACTION_DISABLED,
} },
}), }),
// Notifications from bots // Notifications from bots
@ -141,6 +141,6 @@ module.exports = {
on: StandardActions.ACTION_DISABLED, on: StandardActions.ACTION_DISABLED,
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND, loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
off: StandardActions.ACTION_DONT_NOTIFY, off: StandardActions.ACTION_DONT_NOTIFY,
} },
}), }),
}; };