Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue