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

Allow configuration of multiple moderator users to be invited to all rooms. #234

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

reivilibre
Copy link
Contributor

We want the ability to invite someone else alongside the moderator bot, in all rooms.

This makes moderatorUserId an array instead, moderatorUserIds but otherwise the semantics should be all the same?

@reivilibre reivilibre requested a review from a team as a code owner November 28, 2024 14:04
Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

The template thing bugs me, but it might just be hard to tell from the review window.

I'd like to say if we have the time then a test (based maybe off https://github.com/matrix-org/conference-bot/blob/main/spec/basic.spec.ts#L24-L48) would be helpful here to ensure behavior.

@@ -203,7 +203,7 @@ export class E2ETestEnv {
}
},
},
moderatorUserId: `@modbot:${homeserver.domain}`,
moderatorUserIds: [`@modbot:${homeserver.domain}`],
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we attempt a test for this, should be easy to whip one up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wrote this now, a little fiddly but I think it's better than nothing? :-)

// We can't do this directly with `createSpace` unfortunately, as we could for plain rooms.
await this.client.setUserPowerLevel(this.config.moderatorUserId, subspace.roomId, 100);
for (let moderator of this.config.moderatorUserIds) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically we could convert createSpace to createRoom (with the necessary space state added in) and then just use the getSpace function to pull it as a space object, if we did prefer doing it that way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel more happy leaving it as it is (in a 'known working' state) than messing TBH. It is a shame that these don't compose well though.

@@ -149,7 +146,7 @@ export const SPECIAL_INTEREST_CREATION_TEMPLATE = (moderatorUserId: string) => (
"m.room.power_levels": 50,
},
},
invite: [moderatorUserId],
invite: moderatorUserIds,
Copy link
Contributor

Choose a reason for hiding this comment

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

Hard to tell, but does PUBLIC_ROOM_POWER_LEVELS_TEMPLATE work here? It takes a parameter but we're not giving it one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as you point out, this is probably broken. We haven't used special interest rooms for at least a couple of years now so I guess it wouldn't be a surprise. I may as well fix that obvious part up now though

Issue unrelated to this PR, probably been broken for a while
@reivilibre reivilibre requested a review from Half-Shot December 16, 2024 14:11
Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

Looks good to me, one question.

@@ -30,7 +30,7 @@ export interface IConfig {
managementRoom: string;
idServerDomain?: string;
idServerBrand?: string;
moderatorUserId: string;
moderatorUserIds: string[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to still have the legacy moderatorUserId option, which we internally convert to moderatorUserIds at runtime just for anyone running an old config.

Or failing that, warn on startup that the old field is unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

refusing to start up seems like a reasonable option. I don't think we should force ourselves into too much backwards compat given we don't expect anyone else to be running this really. But refusing to start up sounds like a decent footgun-avoider.

@reivilibre reivilibre requested a review from Half-Shot December 16, 2024 16:59
@reivilibre reivilibre merged commit 9d3d191 into main Dec 17, 2024
5 checks passed
@reivilibre reivilibre deleted the rei/fd25_multimods branch December 17, 2024 12:41
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