Skip to content

Commit a23e96e

Browse files
committed
Minor bugfix after refactoring
* used the wrong field (CR tais) * also renamed method slightly
1 parent 8eeee27 commit a23e96e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

application/src/main/java/org/togetherjava/tjbot/commands/moderation/RejoinModerationRoleListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private void onGuildMemberJoin(@NotNull GuildMemberJoinEvent event) {
6464

6565
for (ModerationRole moderationRole : moderationRoles) {
6666
if (shouldApplyModerationRole(moderationRole, member)) {
67-
reapplyModerationRole(moderationRole, member);
67+
applyModerationRole(moderationRole, member);
6868
}
6969
}
7070
}
@@ -82,7 +82,7 @@ private boolean shouldApplyModerationRole(@NotNull ModerationRole moderationRole
8282
member.getGuild().getIdLong(), member.getIdLong(), moderationRole.revokeAction);
8383
if (lastRevokeAction.isEmpty()) {
8484
// User was never e.g. unmuted
85-
return isActionEffective(lastRevokeAction.orElseThrow());
85+
return isActionEffective(lastApplyAction.orElseThrow());
8686
}
8787

8888
// The last issued action takes priority
@@ -99,7 +99,7 @@ private static boolean isActionEffective(@NotNull ActionRecord action) {
9999
return action.actionExpiresAt() == null || action.actionExpiresAt().isAfter(Instant.now());
100100
}
101101

102-
private static void reapplyModerationRole(@NotNull ModerationRole moderationRole,
102+
private static void applyModerationRole(@NotNull ModerationRole moderationRole,
103103
@NotNull Member member) {
104104
Guild guild = member.getGuild();
105105
logger.info("Reapplied existing {} to user '{}' ({}) in guild '{}' after rejoining.",

0 commit comments

Comments
 (0)