Skip to content

Feature: Add self-service Unquarantine button for some quarantined users - #1603

Open
firasrg wants to merge 3 commits into
developfrom
firasrg/feature/1594-unquarantine-selfservice
Open

firasrg wants to merge 3 commits into
developfrom
firasrg/feature/1594-unquarantine-selfservice

Conversation

@firasrg

@firasrg firasrg commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

When a user is quarantined, the bot posts a message in the #quarantine-zone channel that pings them and offers an "Unquarantine me" button. Users who regained control of their account can get back in without a mod.

demo-qss.mp4

@firasrg
firasrg requested a review from a team as a code owner November 22, 2026 13:26
@firasrg firasrg linked an issue Nov 22, 2026 that may be closed by this pull request
@firasrg
firasrg force-pushed the firasrg/feature/1594-unquarantine-selfservice branch from 15dae73 to d25a231 Compare November 22, 2026 13:31
@sonarqubecloud

Copy link
Copy Markdown

@Tais993 Tais993 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤓 i see potential

Comment on lines +651 to +654
boolean isFirsttime =
actionsStore.getActionsByTargetAscending(guild.getIdLong(), target.getIdLong())
.stream()
.noneMatch(action -> action.actionType() == ModerationAction.QUARANTINE);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use findLastActionAgainstTargetByType and rename isFirsttime to isFirstTime

Suggested change
boolean isFirsttime =
actionsStore.getActionsByTargetAscending(guild.getIdLong(), target.getIdLong())
.stream()
.noneMatch(action -> action.actionType() == ModerationAction.QUARANTINE);
boolean isFirstTime = actionsStore
.findLastActionAgainstTargetByType(guild.getIdLong(), target.getIdLong(),
ModerationAction.QUARANTINE)
.isEmpty();

final String guildId = guild.getId();
final String targetId = target.getId();

if (!isFirsttime) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (!isFirsttime) {
if (!isFirstTime) {

Corresponding to above

Member member = Objects.requireNonNull(event.getMember());

if (!Guilds.hasMemberRole(member, ModerationUtils.getIsQuarantinedRolePredicate(config))) {
event.reply("You are not quarantined anymore!").setEphemeral(true).queue();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
event.reply("You are not quarantined anymore!").setEphemeral(true).queue();
event.reply("You are not quarantined anymore!").setEphemeral(true).queue();

Comment on lines +234 to +239
if (member == null) {
logger.warn(LogMarkers.SENSITIVE,
"scam message detected from a user that is not a member of the guild '{}'.",
guild.getId());
return;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The only channels that are read are TextChannel's (a MessageChannel specifically for Guilds), that said if the user is not a Member of the guild we would have a shitton of NPE's before we arrive at this point. See ScamBlocker:142

@Zabuzard

Copy link
Copy Markdown
Member

could u please add to ur PR description a description of what u changed in the code and how. so we can better review it? like, which parts are new code, what has been moved from where to where? that kind of stuff

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.

Unquarantine Self-Service

3 participants