mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
de-lint Skinner, RoomNotifs
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
b8ad0957b2
commit
b98c105dcc
@ -140,11 +140,9 @@ src/Resend.js
|
|||||||
src/RichText.js
|
src/RichText.js
|
||||||
src/Roles.js
|
src/Roles.js
|
||||||
src/RoomListSorter.js
|
src/RoomListSorter.js
|
||||||
src/RoomNotifs.js
|
|
||||||
src/Rooms.js
|
src/Rooms.js
|
||||||
src/ScalarAuthClient.js
|
src/ScalarAuthClient.js
|
||||||
src/ScalarMessaging.js
|
src/ScalarMessaging.js
|
||||||
src/Skinner.js
|
|
||||||
src/stores/LifecycleStore.js
|
src/stores/LifecycleStore.js
|
||||||
src/TabComplete.js
|
src/TabComplete.js
|
||||||
src/TabCompleteEntries.js
|
src/TabCompleteEntries.js
|
||||||
|
@ -52,7 +52,7 @@ export function getRoomNotifsState(roomId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function setRoomNotifsState(roomId, newState) {
|
export function setRoomNotifsState(roomId, newState) {
|
||||||
if (newState == MUTE) {
|
if (newState === MUTE) {
|
||||||
return setRoomNotifsStateMuted(roomId);
|
return setRoomNotifsStateMuted(roomId);
|
||||||
} else {
|
} else {
|
||||||
return setRoomNotifsStateUnmuted(roomId, newState);
|
return setRoomNotifsStateUnmuted(roomId, newState);
|
||||||
@ -80,11 +80,11 @@ function setRoomNotifsStateMuted(roomId) {
|
|||||||
kind: 'event_match',
|
kind: 'event_match',
|
||||||
key: 'room_id',
|
key: 'room_id',
|
||||||
pattern: roomId,
|
pattern: roomId,
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
'dont_notify',
|
'dont_notify',
|
||||||
]
|
],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return q.all(promises);
|
return q.all(promises);
|
||||||
@ -99,16 +99,16 @@ function setRoomNotifsStateUnmuted(roomId, newState) {
|
|||||||
promises.push(cli.deletePushRule('global', 'override', overrideMuteRule.rule_id));
|
promises.push(cli.deletePushRule('global', 'override', overrideMuteRule.rule_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newState == 'all_messages') {
|
if (newState === 'all_messages') {
|
||||||
const roomRule = cli.getRoomPushRule('global', roomId);
|
const roomRule = cli.getRoomPushRule('global', roomId);
|
||||||
if (roomRule) {
|
if (roomRule) {
|
||||||
promises.push(cli.deletePushRule('global', 'room', roomRule.rule_id));
|
promises.push(cli.deletePushRule('global', 'room', roomRule.rule_id));
|
||||||
}
|
}
|
||||||
} else if (newState == 'mentions_only') {
|
} else if (newState === 'mentions_only') {
|
||||||
promises.push(cli.addPushRule('global', 'room', roomId, {
|
promises.push(cli.addPushRule('global', 'room', roomId, {
|
||||||
actions: [
|
actions: [
|
||||||
'dont_notify',
|
'dont_notify',
|
||||||
]
|
],
|
||||||
}));
|
}));
|
||||||
// https://matrix.org/jira/browse/SPEC-400
|
// https://matrix.org/jira/browse/SPEC-400
|
||||||
promises.push(cli.setPushRuleEnabled('global', 'room', roomId, true));
|
promises.push(cli.setPushRuleEnabled('global', 'room', roomId, true));
|
||||||
@ -119,8 +119,8 @@ function setRoomNotifsStateUnmuted(roomId, newState) {
|
|||||||
{
|
{
|
||||||
set_tweak: 'sound',
|
set_tweak: 'sound',
|
||||||
value: 'default',
|
value: 'default',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}));
|
}));
|
||||||
// https://matrix.org/jira/browse/SPEC-400
|
// https://matrix.org/jira/browse/SPEC-400
|
||||||
promises.push(cli.setPushRuleEnabled('global', 'room', roomId, true));
|
promises.push(cli.setPushRuleEnabled('global', 'room', roomId, true));
|
||||||
@ -145,20 +145,10 @@ function isRuleForRoom(roomId, rule) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const cond = rule.conditions[0];
|
const cond = rule.conditions[0];
|
||||||
if (
|
return (cond.kind === 'event_match' && cond.key === 'room_id' && cond.pattern === roomId);
|
||||||
cond.kind == 'event_match' &&
|
|
||||||
cond.key == 'room_id' &&
|
|
||||||
cond.pattern == roomId
|
|
||||||
) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMuteRule(rule) {
|
function isMuteRule(rule) {
|
||||||
return (
|
return (rule.actions.length === 1 && rule.actions[0] === 'dont_notify');
|
||||||
rule.actions.length == 1 &&
|
|
||||||
rule.actions[0] == 'dont_notify'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,19 +51,18 @@ class Skinner {
|
|||||||
if (this.components !== null) {
|
if (this.components !== null) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Attempted to load a skin while a skin is already loaded"+
|
"Attempted to load a skin while a skin is already loaded"+
|
||||||
"If you want to change the active skin, call resetSkin first"
|
"If you want to change the active skin, call resetSkin first");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
this.components = {};
|
this.components = {};
|
||||||
var compKeys = Object.keys(skinObject.components);
|
const compKeys = Object.keys(skinObject.components);
|
||||||
for (var i = 0; i < compKeys.length; ++i) {
|
for (let i = 0; i < compKeys.length; ++i) {
|
||||||
var comp = skinObject.components[compKeys[i]];
|
const comp = skinObject.components[compKeys[i]];
|
||||||
this.addComponent(compKeys[i], comp);
|
this.addComponent(compKeys[i], comp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addComponent(name, comp) {
|
addComponent(name, comp) {
|
||||||
var slot = name;
|
let slot = name;
|
||||||
if (comp.replaces !== undefined) {
|
if (comp.replaces !== undefined) {
|
||||||
if (comp.replaces.indexOf('.') > -1) {
|
if (comp.replaces.indexOf('.') > -1) {
|
||||||
slot = comp.replaces;
|
slot = comp.replaces;
|
||||||
|
Loading…
Reference in New Issue
Block a user