Apply prettier formatting

This commit is contained in:
Michael Weimann 2022-12-12 12:24:14 +01:00
parent 1cac306093
commit 526645c791
No known key found for this signature in database
GPG key ID: 53F535A266BB9584
1576 changed files with 65385 additions and 62478 deletions

View file

@ -56,30 +56,35 @@ export class BanList {
}
get serverRules(): ListRule[] {
return this._rules.filter(r => r.kind === RULE_SERVER);
return this._rules.filter((r) => r.kind === RULE_SERVER);
}
get userRules(): ListRule[] {
return this._rules.filter(r => r.kind === RULE_USER);
return this._rules.filter((r) => r.kind === RULE_USER);
}
get roomRules(): ListRule[] {
return this._rules.filter(r => r.kind === RULE_ROOM);
return this._rules.filter((r) => r.kind === RULE_ROOM);
}
async banEntity(kind: string, entity: string, reason: string): Promise<any> {
await MatrixClientPeg.get().sendStateEvent(this._roomId, ruleTypeToStable(kind), {
entity: entity,
reason: reason,
recommendation: recommendationToStable(RECOMMENDATION_BAN, true),
}, "rule:" + entity);
await MatrixClientPeg.get().sendStateEvent(
this._roomId,
ruleTypeToStable(kind),
{
entity: entity,
reason: reason,
recommendation: recommendationToStable(RECOMMENDATION_BAN, true),
},
"rule:" + entity,
);
this._rules.push(new ListRule(entity, RECOMMENDATION_BAN, reason, ruleTypeToStable(kind)));
}
async unbanEntity(kind: string, entity: string): Promise<any> {
// Empty state event is effectively deleting it.
await MatrixClientPeg.get().sendStateEvent(this._roomId, ruleTypeToStable(kind), {}, "rule:" + entity);
this._rules = this._rules.filter(r => {
this._rules = this._rules.filter((r) => {
if (r.kind !== ruleTypeToStable(kind)) return true;
if (r.entity !== entity) return true;
return false; // we just deleted this rule
@ -99,9 +104,9 @@ export class BanList {
const kind = ruleTypeToStable(eventType);
const entity = ev.getContent()['entity'];
const recommendation = ev.getContent()['recommendation'];
const reason = ev.getContent()['reason'];
const entity = ev.getContent()["entity"];
const recommendation = ev.getContent()["recommendation"];
const reason = ev.getContent()["reason"];
if (!entity || !recommendation || !reason) continue;
this._rules.push(new ListRule(entity, recommendation, reason, kind));