mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-19 11:41:30 +00:00
Handle edge case bug in banned page (#801)
This commit is contained in:
parent
73bb810678
commit
bf2e36e8a4
2 changed files with 24 additions and 16 deletions
|
@ -17,16 +17,19 @@
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<span>
|
||||
@if (Model.ModCase.ExpiresAt != null)
|
||||
{
|
||||
@Model.Translate(ModerationStrings.SuspensionExpiration, TimeZoneInfo.ConvertTime(Model.ModCase.ExpiresAt.Value, timeZoneInfo).ToString("M/d/yyyy @ h:mm tt"))
|
||||
}
|
||||
else
|
||||
{
|
||||
@Model.Translate(ModerationStrings.SuspensionExpiration, Model.Translate(ModerationStrings.DoesNotExpire))
|
||||
}
|
||||
</span>
|
||||
@if (Model.ModCase != null)
|
||||
{
|
||||
<span>
|
||||
@if (Model.ModCase.ExpiresAt != null)
|
||||
{
|
||||
@Model.Translate(ModerationStrings.SuspensionExpiration, TimeZoneInfo.ConvertTime(Model.ModCase.ExpiresAt.Value, timeZoneInfo).ToString("M/d/yyyy @ h:mm tt"))
|
||||
}
|
||||
else
|
||||
{
|
||||
@Model.Translate(ModerationStrings.SuspensionExpiration, Model.Translate(ModerationStrings.DoesNotExpire))
|
||||
}
|
||||
</span>
|
||||
}
|
||||
|
||||
<ul>
|
||||
<li>@Model.Translate(ModerationStrings.LbpOnlineMultiplayer)</li>
|
||||
|
@ -36,10 +39,13 @@
|
|||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@Model.Translate(ModerationStrings.SuspensionReason, Model.ModCase.Reason)
|
||||
</p>
|
||||
|
||||
@if (Model.ModCase != null)
|
||||
{
|
||||
<p>
|
||||
@Model.Translate(ModerationStrings.SuspensionReason, Model.ModCase.Reason)
|
||||
</p>
|
||||
}
|
||||
|
||||
<p>
|
||||
@Model.Translate(ModerationStrings.SuspensionCircumventWarning)
|
||||
</p>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using JetBrains.Annotations;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Moderation;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
using LBPUnion.ProjectLighthouse.Types.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Types.Moderation.Cases;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
@ -14,7 +16,7 @@ public class BannedUserPage : BaseLayout
|
|||
public BannedUserPage(DatabaseContext database) : base(database)
|
||||
{ }
|
||||
|
||||
public ModerationCaseEntity ModCase = null!;
|
||||
public ModerationCaseEntity? ModCase;
|
||||
|
||||
[UsedImplicitly]
|
||||
public async Task<IActionResult> OnGet()
|
||||
|
@ -30,7 +32,7 @@ public class BannedUserPage : BaseLayout
|
|||
.Where(c => c.DismissedAt != null)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (modCase == null) return this.Redirect("~/");
|
||||
if (modCase == null) Logger.Warn($"User {user.UserId} is banned but has no mod case?", LogArea.Login);
|
||||
|
||||
this.ModCase = modCase;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue