-
Notifications
You must be signed in to change notification settings - Fork 56
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
Don't allow mods to demote bot or members of management room in protected rooms #555
base: main
Are you sure you want to change the base?
Conversation
As someone involved in communities using this command often: this needs a way to be turned off, as some communities explicitly use powerlevel changes amongst themselves, if not on themselves. This would be a breaking change for them. |
Would you be able to expand on the use case there? Power level changes should be infrequent, and demotions are questionable. |
Would allowing a |
In most cases, it's generally moderators managing their own powerlevel through mjolnir (stepping down voluntarily (taking a break, leaving, ...), taking temporary permissions for a room action like re-setting room icons, ...) or using mutes as a "hey, calm down for a moment", or just removing powerlevels to reduce unnessecary permission grants. As suggested, a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise lgtm - thanks!
src/commands/SetPowerLevelCommand.ts
Outdated
for (const targetRoomId of targetRooms) { | ||
try { | ||
if (!force) { | ||
if (target === mjolnirId || mjolnir.moderators.checkMembership(target)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should fail if target === mjolnirId
, and level < targetLevel
, even with --force
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, can you break that one down real quick? this sounds like you're saying it should fail when it tries to promote itself, which sounds like expected API behavior anyways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targetLevel
is the current level - see other comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, you're trying to prevent demoting the bot itself? how would you handle gracefully removing the bot from a room, given you cant explicitly have it demote itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you would puppet the bot and have it demote itself. Mjolnir is tolerable to a human operator using the account at the same time (deliberately - this is also why it doesn't filter itself out when checking for commands. Worst case, a human operator can go to the management room as the bot, send a ban command, and it all works fine)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't the bot immune to self-bans via how powerlevels work? or is that not why protection-invoked selfbans fail?
besides, how does this work in an environment where humans dont possess either the login nor homeserver admin privilges, and use mjolnir to delegate permissions in an auditable fashion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Power levels don't prevent the bot from banning itself. They also don't prevent the bot from demoting itself, either. I'm not sure what you mean by "protection-invoked selfbans", but it sounds like an unrelated issue.
At the current stage in the project, Mjolnir isn't really meant to be run on behalf of someone else. We aren't able to commit a ton of time into supporting alternative use cases at the moment, so have narrowed our maintenance scope to, roughly speaking, "matrix.org plus 10%". This means some features required by matrix.org may interfere with usage that falls outside the plus 10% range. Alternative bots, like Draupnir, have different allocations for maintenance and feature set which may be more beneficial for your particular use case.
src/commands/SetPowerLevelCommand.ts
Outdated
const targetLevel = currentLevels["users"][mjolnirId]; | ||
if (level < targetLevel) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targetLevel
at a glance feels like the destination level, making this statement a bit confusing. Maybe currentLevel
would fit better?
No description provided.