mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-23 13:41:31 +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,6 +17,8 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@if (Model.ModCase != null)
|
||||||
|
{
|
||||||
<span>
|
<span>
|
||||||
@if (Model.ModCase.ExpiresAt != null)
|
@if (Model.ModCase.ExpiresAt != null)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +29,7 @@
|
||||||
@Model.Translate(ModerationStrings.SuspensionExpiration, Model.Translate(ModerationStrings.DoesNotExpire))
|
@Model.Translate(ModerationStrings.SuspensionExpiration, Model.Translate(ModerationStrings.DoesNotExpire))
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
|
}
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>@Model.Translate(ModerationStrings.LbpOnlineMultiplayer)</li>
|
<li>@Model.Translate(ModerationStrings.LbpOnlineMultiplayer)</li>
|
||||||
|
@ -36,9 +39,12 @@
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@if (Model.ModCase != null)
|
||||||
|
{
|
||||||
<p>
|
<p>
|
||||||
@Model.Translate(ModerationStrings.SuspensionReason, Model.ModCase.Reason)
|
@Model.Translate(ModerationStrings.SuspensionReason, Model.ModCase.Reason)
|
||||||
</p>
|
</p>
|
||||||
|
}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@Model.Translate(ModerationStrings.SuspensionCircumventWarning)
|
@Model.Translate(ModerationStrings.SuspensionCircumventWarning)
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using LBPUnion.ProjectLighthouse.Database;
|
using LBPUnion.ProjectLighthouse.Database;
|
||||||
|
using LBPUnion.ProjectLighthouse.Logging;
|
||||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Entities.Moderation;
|
using LBPUnion.ProjectLighthouse.Types.Entities.Moderation;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||||
|
using LBPUnion.ProjectLighthouse.Types.Logging;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Moderation.Cases;
|
using LBPUnion.ProjectLighthouse.Types.Moderation.Cases;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
@ -14,7 +16,7 @@ public class BannedUserPage : BaseLayout
|
||||||
public BannedUserPage(DatabaseContext database) : base(database)
|
public BannedUserPage(DatabaseContext database) : base(database)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public ModerationCaseEntity ModCase = null!;
|
public ModerationCaseEntity? ModCase;
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public async Task<IActionResult> OnGet()
|
public async Task<IActionResult> OnGet()
|
||||||
|
@ -30,7 +32,7 @@ public class BannedUserPage : BaseLayout
|
||||||
.Where(c => c.DismissedAt != null)
|
.Where(c => c.DismissedAt != null)
|
||||||
.FirstOrDefaultAsync();
|
.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;
|
this.ModCase = modCase;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue