From de228cb242a25a8f2e95459a21f7df7498732923 Mon Sep 17 00:00:00 2001 From: Slendy Date: Wed, 31 May 2023 15:12:40 -0500 Subject: [PATCH] Fix client side query in BannedPage --- .../Pages/Login/BannedUserPage.cshtml.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ProjectLighthouse.Servers.Website/Pages/Login/BannedUserPage.cshtml.cs b/ProjectLighthouse.Servers.Website/Pages/Login/BannedUserPage.cshtml.cs index ae0e2e88..d951591e 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Login/BannedUserPage.cshtml.cs +++ b/ProjectLighthouse.Servers.Website/Pages/Login/BannedUserPage.cshtml.cs @@ -24,10 +24,11 @@ public class BannedUserPage : BaseLayout if (user == null) return this.Redirect("~/login"); if (!user.IsBanned) return this.Redirect("~/"); - ModerationCaseEntity? modCase = await this.Database.Cases - .LastOrDefaultAsync(c => c.AffectedId == user.UserId - && c.Type == CaseType.UserBan - && !c.Dismissed); + ModerationCaseEntity? modCase = await this.Database.Cases.OrderByDescending(c => c.CreatedAt) + .Where(c => c.AffectedId == user.UserId) + .Where(c => c.Type == CaseType.UserBan) + .Where(c => c.DismissedAt != null) + .FirstOrDefaultAsync(); if (modCase == null) return this.Redirect("~/");