mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
Fix lint errors in VectorPushRulesDefinitions.js
Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
parent
c83521bb31
commit
6d8649855a
@ -18,8 +18,8 @@ limitations under the License.
|
||||
|
||||
import { _td } from '../languageHandler';
|
||||
|
||||
var StandardActions = require('./StandardActions');
|
||||
var PushRuleVectorState = require('./PushRuleVectorState');
|
||||
const StandardActions = require('./StandardActions');
|
||||
const PushRuleVectorState = require('./PushRuleVectorState');
|
||||
|
||||
class VectorPushRuleDefinition {
|
||||
constructor(opts) {
|
||||
@ -30,16 +30,16 @@ class VectorPushRuleDefinition {
|
||||
|
||||
// Translate the rule actions and its enabled value into vector state
|
||||
ruleToVectorState(rule) {
|
||||
var enabled = false;
|
||||
var actions = null;
|
||||
let enabled = false;
|
||||
let actions = null;
|
||||
if (rule) {
|
||||
enabled = rule.enabled;
|
||||
actions = rule.actions;
|
||||
}
|
||||
|
||||
for (var stateKey in PushRuleVectorState.states) {
|
||||
var state = PushRuleVectorState.states[stateKey];
|
||||
var vectorStateToActions = this.vectorStateToActions[state];
|
||||
for (const stateKey in PushRuleVectorState.states) {
|
||||
const state = PushRuleVectorState.states[stateKey];
|
||||
const vectorStateToActions = this.vectorStateToActions[state];
|
||||
|
||||
if (!vectorStateToActions) {
|
||||
// No defined actions means that this vector state expects a disabled (or absent) rule
|
||||
@ -58,7 +58,7 @@ class VectorPushRuleDefinition {
|
||||
JSON.stringify(rule));
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
on: StandardActions.ACTION_NOTIFY,
|
||||
loud: StandardActions.ACTION_HIGHLIGHT_DEFAULT_SOUND,
|
||||
off: StandardActions.ACTION_DISABLED
|
||||
}
|
||||
off: StandardActions.ACTION_DISABLED,
|
||||
},
|
||||
}),
|
||||
|
||||
// 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.
|
||||
on: StandardActions.ACTION_NOTIFY,
|
||||
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
|
||||
@ -93,8 +93,8 @@ module.exports = {
|
||||
vectorStateToActions: {
|
||||
on: StandardActions.ACTION_NOTIFY,
|
||||
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
|
||||
off: StandardActions.ACTION_DONT_NOTIFY
|
||||
}
|
||||
off: StandardActions.ACTION_DONT_NOTIFY,
|
||||
},
|
||||
}),
|
||||
|
||||
// Messages just sent to a group chat room
|
||||
@ -106,8 +106,8 @@ module.exports = {
|
||||
vectorStateToActions: {
|
||||
on: StandardActions.ACTION_NOTIFY,
|
||||
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
|
||||
off: StandardActions.ACTION_DONT_NOTIFY
|
||||
}
|
||||
off: StandardActions.ACTION_DONT_NOTIFY,
|
||||
},
|
||||
}),
|
||||
|
||||
// Invitation for the user
|
||||
@ -117,8 +117,8 @@ module.exports = {
|
||||
vectorStateToActions: {
|
||||
on: StandardActions.ACTION_NOTIFY,
|
||||
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
|
||||
off: StandardActions.ACTION_DISABLED
|
||||
}
|
||||
off: StandardActions.ACTION_DISABLED,
|
||||
},
|
||||
}),
|
||||
|
||||
// Incoming call
|
||||
@ -128,8 +128,8 @@ module.exports = {
|
||||
vectorStateToActions: {
|
||||
on: StandardActions.ACTION_NOTIFY,
|
||||
loud: StandardActions.ACTION_NOTIFY_RING_SOUND,
|
||||
off: StandardActions.ACTION_DISABLED
|
||||
}
|
||||
off: StandardActions.ACTION_DISABLED,
|
||||
},
|
||||
}),
|
||||
|
||||
// Notifications from bots
|
||||
@ -141,6 +141,6 @@ module.exports = {
|
||||
on: StandardActions.ACTION_DISABLED,
|
||||
loud: StandardActions.ACTION_NOTIFY_DEFAULT_SOUND,
|
||||
off: StandardActions.ACTION_DONT_NOTIFY,
|
||||
}
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user