Rename /modPanel to /moderation

This commit is contained in:
jvyden 2022-06-17 19:50:01 -04:00
commit a6f077725a
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
11 changed files with 32 additions and 39 deletions

View file

@ -41,7 +41,7 @@ else
}
}
<a class="ui blue button" href="/modPanel">
<a class="ui blue button" href="/moderation">
<i class="user shield icon"></i>
<span>View Mod Panel</span>
</a>

View file

@ -1,4 +1,5 @@
@page "/modPanel"
@page "/moderation"
@using System.Diagnostics
@using LBPUnion.ProjectLighthouse.Administration
@using LBPUnion.ProjectLighthouse.Extensions
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.ModPanelPage
@ -6,8 +7,19 @@
@{
Layout = "Layouts/BaseLayout";
Model.Title = "Moderation Panel";
if (Model.User == null) throw new ArgumentNullException($"{nameof(Model)}.{nameof(User)}");
// Technically, this should never happen but I'm going to handle it anyways.
if (!Model.User.IsModerator)
{
if(Debugger.IsAttached) Debugger.Break();
throw new Exception("Tried to render mod panel with user whose not mod somehow???");
}
}
<p>Hello, <b>@Model.User.Username.</b></p>
@if (!this.Request.IsMobile())
{
<div class="ui grid">

View file

@ -19,8 +19,8 @@ public class ModPanelPage : BaseLayout
if (user == null) return this.Redirect("~/login");
if (!user.IsModerator) return this.NotFound();
this.Statistics.Add(new AdminPanelStatistic("Reports", await StatisticsHelper.ReportCount(), "/modPanel/reports/0"));
this.Statistics.Add(new AdminPanelStatistic("Cases", await StatisticsHelper.CaseCount(), "/modPanel/cases/0"));
this.Statistics.Add(new AdminPanelStatistic("Reports", await StatisticsHelper.ReportCount(), "/moderation/reports/0"));
this.Statistics.Add(new AdminPanelStatistic("Cases", await StatisticsHelper.CaseCount(), "/moderation/cases/0"));
return this.Page();
}

View file

@ -1,4 +1,4 @@
@page "/modPanel/reports/{pageNumber:int}"
@page "/moderation/reports/{pageNumber:int}"
@using LBPUnion.ProjectLighthouse.Administration.Reports
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.ReportsPage
@ -9,7 +9,7 @@
<p>There are @Model.ReportCount total reports.</p>
<form action="/modPanel/reports/0">
<form action="/moderation/reports/0">
<div class="ui icon input">
<input type="text" name="name" placeholder="Search reports..." value="@Model.SearchValue">
<i class="search icon"></i>
@ -69,11 +69,11 @@
</div>
<br>
<a class="ui green small button" href="/modPanel/report/@report.ReportId/dismiss">
<a class="ui green small button" href="/moderation/report/@report.ReportId/dismiss">
<i class="checkmark icon"></i>
<span>Dismiss</span>
</a>
<a class="ui red small button" href="/modPanel/report/@report.ReportId/remove">
<a class="ui red small button" href="/moderation/report/@report.ReportId/remove">
<i class="trash icon"></i>
<span>Remove all related assets</span>
</a>
@ -239,10 +239,10 @@
@if (Model.PageNumber != 0)
{
<a href="/modPanel/reports/@(Model.PageNumber - 1)@(Model.SearchValue.Length == 0 ? "" : "?name=" + Model.SearchValue)">Previous Page</a>
<a href="/moderation/reports/@(Model.PageNumber - 1)@(Model.SearchValue.Length == 0 ? "" : "?name=" + Model.SearchValue)">Previous Page</a>
}
@(Model.PageNumber + 1) / @(Model.PageAmount)
@if (Model.PageNumber < Model.PageAmount - 1)
{
<a href="/modPanel/reports/@(Model.PageNumber + 1)@(Model.SearchValue.Length == 0 ? "" : "?name=" + Model.SearchValue)">Next Page</a>
<a href="/moderation/reports/@(Model.PageNumber + 1)@(Model.SearchValue.Length == 0 ? "" : "?name=" + Model.SearchValue)">Next Page</a>
}

View file

@ -28,7 +28,7 @@ public class ReportsPage : BaseLayout
{
User? user = this.Database.UserFromWebRequest(this.Request);
if (user == null) return this.Redirect("~/login");
if (!user.IsAdmin) return this.NotFound();
if (!user.IsModerator) return this.NotFound();
if (string.IsNullOrWhiteSpace(name)) name = "";
@ -40,7 +40,7 @@ public class ReportsPage : BaseLayout
this.PageAmount = Math.Max(1, (int)Math.Ceiling((double)this.ReportCount / ServerStatics.PageSize));
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount)
return this.Redirect($"/modPanel/reports/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
return this.Redirect($"/moderation/reports/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
this.Reports = await this.Database.Reports.Include(r => r.ReportingPlayer)
.Where(r => r.ReportingPlayer.Username.Contains(this.SearchValue))