From e907930623020ff90c860152794641ac22a12c44 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Thu, 28 Sep 2023 00:07:46 +0500 Subject: [PATCH] Fix auto-unban and auto-unmute always triggering (#119) Flipping `>` to `<=` changed null handling semantics within the operator, causing the unban/unmute code to always run Signed-off-by: Octol1ttle --- src/Services/Update/MemberUpdateService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Services/Update/MemberUpdateService.cs b/src/Services/Update/MemberUpdateService.cs index 3e87b79..3db307d 100644 --- a/src/Services/Update/MemberUpdateService.cs +++ b/src/Services/Update/MemberUpdateService.cs @@ -123,7 +123,7 @@ public sealed partial class MemberUpdateService : BackgroundService private async Task TryAutoUnbanAsync( Snowflake guildId, Snowflake id, MemberData data, CancellationToken ct) { - if (DateTimeOffset.UtcNow <= data.BannedUntil) + if (data.BannedUntil is null || DateTimeOffset.UtcNow <= data.BannedUntil) { return Result.FromSuccess(); } @@ -141,7 +141,7 @@ public sealed partial class MemberUpdateService : BackgroundService private async Task TryAutoUnmuteAsync( Snowflake guildId, Snowflake id, MemberData data, CancellationToken ct) { - if (DateTimeOffset.UtcNow <= data.MutedUntil) + if (data.MutedUntil is null || DateTimeOffset.UtcNow <= data.MutedUntil) { return Result.FromSuccess(); }