Skip to content

Adding /quarantine and /unquarantine #398

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

Merged
merged 4 commits into from
Mar 7, 2022

Conversation

Zabuzard
Copy link
Member

Overview

This adds the /quarantine and /unquarantine commands. They act mostly as preparation for #394 , but should also aid as help for mods and staff to manually resolve situations.

Quarantining is similar to muting, but will have subtle differences in how it is handled in the server, permission-wise. For example, a quarantined user might only be given access to a special #quarantine_zone channel, where he can talk to the moderators. Also, they will have less permissions than muted users, for example not being able to view any other channel anymore.

Quarantines are permanent, but the code supports temporary quarantines as well (this will be interesting for the scam blocker).

apply

quarantine_zone

unquarantine

Details

This is mostly a copy&paste&edit of mute. Touched stuff:

Commands:

  • QuarantineCommand
  • UnquarantineCommand
  • added enum values in ModerationAction
  • added role helpers in ModerationUtils

To auto-revoke temporary quarantines:

  • TemporaryQuarantineAction
  • edits in TemporaryModerationRoutine

To reapply the role after rejoin:

  • merged existing RejoinMuteListener with quarantine into more general RejoinModerationRoleListener

Config

This changed the config. See the template:

"quarantinedRolePattern": "Quarantined"

@Zabuzard Zabuzard added new command Add a new command or group of commands to the bot priority: major labels Feb 24, 2022
@Zabuzard Zabuzard added this to the Improvement phase 1 milestone Feb 24, 2022
@Zabuzard Zabuzard requested review from a team as code owners February 24, 2022 10:27
@Zabuzard Zabuzard self-assigned this Feb 24, 2022
@Zabuzard Zabuzard mentioned this pull request Feb 24, 2022
14 tasks
@Zabuzard Zabuzard force-pushed the feature/add_quarantine_commands branch from 7486a0d to 1eda98b Compare February 24, 2022 11:28
@Zabuzard
Copy link
Member Author

SonarCloud Quality Gate failed. Quality Gate failed

Bug A 0 Bugs Vulnerability A 0 Vulnerabilities Security Hotspot A 0 Security Hotspots Code Smell A 3 Code Smells

0.0% 0.0% Coverage 11.1% 11.1% Duplication

Smells are code duplication. The duplication is between mute and quarantine. While it is correct, I think it might be better to have the duplication. Overly coupling both actions would result in a pretty messy code that is hard to view isolated.

After all, the two commands serve different purposes.

An argument could be made to abstract both to some sort of "apply role" commands. Maybe it is worth pursuing this direction, but the claimed duplication is actually mostly on the user-responses and command layout, which wouldnt be covered by such a merge anyways...

So for the same reason we accepted the duplication between ban, warn and mute, I am voting to accept it here as well.

* used the wrong field (CR tais)
* also renamed method slightly
@Zabuzard Zabuzard requested a review from Tais993 February 25, 2022 08:01
Copy link
Member

@Tais993 Tais993 left a comment

Choose a reason for hiding this comment

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

Mr Styling has returned, besides that;

I'm fine with ignoring the code duplication, so 👍 from me

@Zabuzard Zabuzard requested a review from Tais993 February 28, 2022 08:19
Tais993
Tais993 previously approved these changes Feb 28, 2022
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

0.0% 0.0% Coverage
11.4% 11.4% Duplication

@Zabuzard
Copy link
Member Author

Zabuzard commented Mar 7, 2022

One week has passed, merging

@Zabuzard Zabuzard merged commit dff6068 into develop Mar 7, 2022
@Zabuzard Zabuzard deleted the feature/add_quarantine_commands branch March 7, 2022 08:25
Tais993 pushed a commit that referenced this pull request Mar 14, 2022
Tais993 pushed a commit that referenced this pull request Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new command Add a new command or group of commands to the bot priority: major
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants