Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorperate Mjolnir's new Policy List Manager #5

Merged
merged 5 commits into from
Jan 31, 2023

Conversation

src/Mjolnir.ts Outdated Show resolved Hide resolved
Comment on lines 406 to 418
// We filter out all policy rooms so that we only protect ones that are
// explicitly protected, so that we don't try to protect lists that we are just watching.
const filterOutManagementAndPolicyRooms = (roomId: string) => {
const policyListIds = this.policyLists.map(list => list.roomId);
const policyListIds = this.policyListManager.lists.map(list => list.roomId);
return roomId !== this.managementRoomId && !policyListIds.includes(roomId);
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a smell that this filter has been ignored and not included as part of the PolicyListManager.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that's because it's to do with protected rooms, not the policy list manager... maybe it could be moved there though?

src/models/PolicyList.ts Outdated Show resolved Hide resolved
@@ -70,7 +71,7 @@ describe("UnbanBanCommand", () => {

it("should be able to detect servers with ban reasons", async () => {
const mjolnir = createTestMjolnir();
(<any>mjolnir).lists = [{listShortcode: "test"}];
(<any>mjolnir).policyListManager.lists = [{listShortcode: "test"}];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I think there has been a precedent for exposing these utilities externally from Mjolnir, I think we should at least try keeping them internal to Mjolnir and delegating.

src/Mjolnir.ts Show resolved Hide resolved
src/models/MatrixDataManager.ts Show resolved Hide resolved
src/models/PolicyList.ts Outdated Show resolved Hide resolved
src/models/PolicyList.ts Outdated Show resolved Hide resolved
src/utils.ts Outdated Show resolved Hide resolved
src/utils.ts Outdated Show resolved Hide resolved
src/Mjolnir.ts Show resolved Hide resolved
@Gnuxie Gnuxie force-pushed the gnuxie/policy-list-manager branch 2 times, most recently from 96ee740 to cb6af7e Compare January 26, 2023 17:15
@Gnuxie Gnuxie merged commit 0d4864e into main Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants