Appease the linter
This commit is contained in:
parent
11068d189c
commit
3e4a721111
8 changed files with 30 additions and 17 deletions
|
@ -29,9 +29,15 @@ export const SERVER_RULE_TYPES = [RULE_SERVER, "org.matrix.mjolnir.rule.server"]
|
|||
export const ALL_RULE_TYPES = [...USER_RULE_TYPES, ...ROOM_RULE_TYPES, ...SERVER_RULE_TYPES];
|
||||
|
||||
export function ruleTypeToStable(rule: string, unstable = true): string {
|
||||
if (USER_RULE_TYPES.includes(rule)) return unstable ? USER_RULE_TYPES[USER_RULE_TYPES.length - 1] : RULE_USER;
|
||||
if (ROOM_RULE_TYPES.includes(rule)) return unstable ? ROOM_RULE_TYPES[ROOM_RULE_TYPES.length - 1] : RULE_ROOM;
|
||||
if (SERVER_RULE_TYPES.includes(rule)) return unstable ? SERVER_RULE_TYPES[SERVER_RULE_TYPES.length - 1] : RULE_SERVER;
|
||||
if (USER_RULE_TYPES.includes(rule)) {
|
||||
return unstable ? USER_RULE_TYPES[USER_RULE_TYPES.length - 1] : RULE_USER;
|
||||
}
|
||||
if (ROOM_RULE_TYPES.includes(rule)) {
|
||||
return unstable ? ROOM_RULE_TYPES[ROOM_RULE_TYPES.length - 1] : RULE_ROOM;
|
||||
}
|
||||
if (SERVER_RULE_TYPES.includes(rule)) {
|
||||
return unstable ? SERVER_RULE_TYPES[SERVER_RULE_TYPES.length - 1] : RULE_SERVER;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,9 @@ export const RECOMMENDATION_BAN = "m.ban";
|
|||
export const RECOMMENDATION_BAN_TYPES = [RECOMMENDATION_BAN, "org.matrix.mjolnir.ban"];
|
||||
|
||||
export function recommendationToStable(recommendation: string, unstable = true): string {
|
||||
if (RECOMMENDATION_BAN_TYPES.includes(recommendation)) return unstable ? RECOMMENDATION_BAN_TYPES[RECOMMENDATION_BAN_TYPES.length - 1] : RECOMMENDATION_BAN;
|
||||
if (RECOMMENDATION_BAN_TYPES.includes(recommendation)) {
|
||||
return unstable ? RECOMMENDATION_BAN_TYPES[RECOMMENDATION_BAN_TYPES.length - 1] : RECOMMENDATION_BAN;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,11 +78,13 @@ export class Mjolnir {
|
|||
const resp = await MatrixClientPeg.get().createRoom({
|
||||
name: _t("My Ban List"),
|
||||
topic: _t("This is your list of users/servers you have blocked - don't leave the room!"),
|
||||
preset: "private_chat"
|
||||
preset: "private_chat",
|
||||
});
|
||||
personalRoomId = resp['room_id'];
|
||||
await SettingsStore.setValue("mjolnirPersonalRoom", null, SettingLevel.ACCOUNT, personalRoomId);
|
||||
await SettingsStore.setValue("mjolnirRooms", null, SettingLevel.ACCOUNT, [personalRoomId, ...this._roomIds]);
|
||||
await SettingsStore.setValue(
|
||||
"mjolnirPersonalRoom", null, SettingLevel.ACCOUNT, personalRoomId);
|
||||
await SettingsStore.setValue(
|
||||
"mjolnirRooms", null, SettingLevel.ACCOUNT, [personalRoomId, ...this._roomIds]);
|
||||
}
|
||||
if (!personalRoomId) {
|
||||
throw new Error("Error finding a room ID to use");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue