Skip to content

Commit

Permalink
Always echo policy list changes (#401)
Browse files Browse the repository at this point in the history
closes #392.
  • Loading branch information
Gnuxie authored and Yoric committed Nov 8, 2022
1 parent b16f161 commit d9f1f8f
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/ProtectedRoomsSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class ProtectedRoomsSet {
public async syncLists(verbose = true) {
for (const list of this.policyLists) {
const changes = await list.updateList();
await this.printBanlistChanges(changes, list, true);
await this.printBanlistChanges(changes, list);
}

let hadErrors = false;
Expand Down Expand Up @@ -277,7 +277,7 @@ export class ProtectedRoomsSet {
});
}
// This can fail if the change is very large and it is much less important than applying bans, so do it last.
await this.printBanlistChanges(changes, policyList, true);
await this.printBanlistChanges(changes, policyList);
}

/**
Expand Down Expand Up @@ -408,14 +408,9 @@ export class ProtectedRoomsSet {
/**
* Print the changes to a banlist to the management room.
* @param changes A list of changes that have been made to a particular ban list.
* @param ignoreSelf Whether to exclude changes that have been made by Mjolnir.
* @returns true if the message was sent, false if it wasn't (because there there were no changes to report).
*/
private async printBanlistChanges(changes: ListRuleChange[], list: PolicyList, ignoreSelf = false): Promise<boolean> {
if (ignoreSelf) {
const sender = await this.client.getUserId();
changes = changes.filter(change => change.sender !== sender);
}
private async printBanlistChanges(changes: ListRuleChange[], list: PolicyList): Promise<boolean> {
if (changes.length <= 0) return false;

let html = "";
Expand Down

0 comments on commit d9f1f8f

Please sign in to comment.