diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs
index c3d103be8..deee085d0 100644
--- a/Application/IW4MServer.cs
+++ b/Application/IW4MServer.cs
@@ -481,10 +481,10 @@ namespace IW4MAdmin
await Manager.GetPenaltyService().Create(newReport);
- int reportNum = await Manager.GetClientService().GetClientReportCount(E.Target.ClientId);
- bool isAutoFlagged = await Manager.GetClientService().IsAutoFlagged(E.Target.ClientId);
+ var reportNum = await Manager.GetClientService().GetClientReportCount(E.Target.ClientId);
+ var canBeAutoFlagged = await Manager.GetClientService().CanBeAutoFlagged(E.Target.ClientId);
- if (!E.Target.IsPrivileged() && reportNum >= REPORT_FLAG_COUNT && !isAutoFlagged)
+ if (!E.Target.IsPrivileged() && reportNum >= REPORT_FLAG_COUNT && canBeAutoFlagged)
{
E.Target.Flag(
Utilities.CurrentLocalization.LocalizationIndex["SERVER_AUTO_FLAG_REPORT"]
diff --git a/SharedLibraryCore/Services/ClientService.cs b/SharedLibraryCore/Services/ClientService.cs
index 9de5bc087..8180f61af 100644
--- a/SharedLibraryCore/Services/ClientService.cs
+++ b/SharedLibraryCore/Services/ClientService.cs
@@ -669,22 +669,30 @@ namespace SharedLibraryCore.Services
}
///
- /// indicates if the given clientid has been autoflagged
+ /// indicates if the given clientid can be autoflagged
///
///
///
- public async Task IsAutoFlagged(int clientId)
+ public async Task CanBeAutoFlagged(int clientId)
{
await using var context = _contextFactory.CreateContext(false);
var now = DateTime.UtcNow;
- return await context.Penalties
+ var hasExistingAutoFlag = await context.Penalties
.Where(_penalty => _penalty.Active)
.Where(_penalty => _penalty.OffenderId == clientId)
.Where(_penalty => _penalty.Type == EFPenalty.PenaltyType.Flag)
.Where(_penalty => _penalty.PunisherId == 1)
.Where(_penalty => _penalty.Expires == null || _penalty.Expires > now)
.AnyAsync();
+
+ var hasUnflag = await context.Penalties
+ .Where(_penalty => _penalty.Active)
+ .Where(_penalty => _penalty.OffenderId == clientId)
+ .Where(_penalty => _penalty.Type == EFPenalty.PenaltyType.Unflag)
+ .AnyAsync();
+
+ return !hasExistingAutoFlag && !hasUnflag;
}
///
diff --git a/WebfrontCore/Views/Client/Statistics/Advanced.cshtml b/WebfrontCore/Views/Client/Statistics/Advanced.cshtml
index 9501a2bbb..86d85966a 100644
--- a/WebfrontCore/Views/Client/Statistics/Advanced.cshtml
+++ b/WebfrontCore/Views/Client/Statistics/Advanced.cshtml
@@ -9,7 +9,7 @@
@model Stats.Dtos.AdvancedStatsInfo
@{
ViewBag.Title = "Advanced Client Statistics";
- ViewBag.Description = Model.ClientName;
+ ViewBag.Description = Model.ClientName.StripColors();
const int maxItems = 5;
const string headshotKey = "MOD_HEAD_SHOT";