Prevent role hierarchy issues with infractions#1798
Conversation
MarkKoz
left a comment
There was a problem hiding this comment.
Did you test this first? It won't work because you're comparing role objects against IDs.
Also, do you think it would be scope creep to create a utility function for this role checking, since a similar pattern is being used elsewhere in the codebase?
15b4ab7 to
df7b23b
Compare
|
After a long discussion on discord it was decided to simply prevent the error raised from using A summary of reason is basically that in the other cases we want to know something went wrong, because there shouldn't be an error in any other infractions due to the user being staff (we can successfully mute etc. staff, including Moderators+, it's only starify we can't as it changes nickname which is hierarchy dependant.) Edit: just realised kicks and bans are also hierarchy dependant, so have added the same check to them. |
Now explicitly states that the bot is unable to starify/kick/ban someone who's higher in the role hierarchy
df7b23b to
8e25ed1
Compare
Now uses `>=` instead of `>`, as is meant to happen.
|
After many hours dabbling with the tests I figured out how to fix them. Hopefully this should all now be ready to merge, just needs the reviews 👍 |
jchristgit
left a comment
There was a problem hiding this comment.
I like this. One minor nitpick. Feel free to ignore it completely.
Closes #1780.
log.warningis no longer called when an infraction/pardon fails due to the target being a Moderator+I believe this is what @MarkKoz was after when they created their issue.
Not sure whether we want to still ping
@Moderatorsif the pardon fails for this reason or not, but have left the ping there for now (can remove if requested).