mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-01 09:48:37 +00:00
Rename /modPanel
to /moderation
This commit is contained in:
parent
f04a8000cf
commit
a6f077725a
11 changed files with 32 additions and 39 deletions
|
@ -4,6 +4,9 @@
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ProjectLighthouse" />
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ProjectLighthouse" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
|
<envs>
|
||||||
|
<env name="ASPNETCORE_ENVIRONMENT" value="Development" />
|
||||||
|
</envs>
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
<option name="USE_MONO" value="0" />
|
<option name="USE_MONO" value="0" />
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
<option name="RUNTIME_ARGUMENTS" value="" />
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Lighthouse" type="DotNetProject" factoryName=".NET Project">
|
|
||||||
<option name="EXE_PATH" value="$PROJECT_DIR$/ProjectLighthouse/bin/Debug/net6.0/LBPUnion.ProjectLighthouse" />
|
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ProjectLighthouse" />
|
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
|
||||||
<option name="USE_MONO" value="0" />
|
|
||||||
<option name="RUNTIME_ARGUMENTS" value="" />
|
|
||||||
<option name="PROJECT_PATH" value="$PROJECT_DIR$/ProjectLighthouse/ProjectLighthouse.csproj" />
|
|
||||||
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
|
|
||||||
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
|
||||||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
|
|
||||||
<option name="PROJECT_KIND" value="Unloaded" />
|
|
||||||
<option name="PROJECT_TFM" value="net6.0" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Development Databases" run_configuration_type="docker-deploy" />
|
|
||||||
<option name="Build" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
|
@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Admin;
|
namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Admin;
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("/modPanel/report/{id:int}")]
|
[Route("/moderation/report/{id:int}")]
|
||||||
public class AdminReportController : ControllerBase
|
public class AdminReportController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly Database database;
|
private readonly Database database;
|
||||||
|
@ -48,7 +48,7 @@ public class AdminReportController : ControllerBase
|
||||||
|
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
|
|
||||||
return this.Redirect("~/modPanel/reports/0");
|
return this.Redirect("~/moderation/reports/0");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("dismiss")]
|
[HttpGet("dismiss")]
|
||||||
|
@ -73,6 +73,6 @@ public class AdminReportController : ControllerBase
|
||||||
|
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
|
|
||||||
return this.Redirect("~/modPanel/reports/0");
|
return this.Redirect("~/moderation/reports/0");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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>
|
<i class="user shield icon"></i>
|
||||||
<span>View Mod Panel</span>
|
<span>View Mod Panel</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@page "/modPanel"
|
@page "/moderation"
|
||||||
|
@using System.Diagnostics
|
||||||
@using LBPUnion.ProjectLighthouse.Administration
|
@using LBPUnion.ProjectLighthouse.Administration
|
||||||
@using LBPUnion.ProjectLighthouse.Extensions
|
@using LBPUnion.ProjectLighthouse.Extensions
|
||||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.ModPanelPage
|
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.ModPanelPage
|
||||||
|
@ -6,8 +7,19 @@
|
||||||
@{
|
@{
|
||||||
Layout = "Layouts/BaseLayout";
|
Layout = "Layouts/BaseLayout";
|
||||||
Model.Title = "Moderation Panel";
|
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())
|
@if (!this.Request.IsMobile())
|
||||||
{
|
{
|
||||||
<div class="ui grid">
|
<div class="ui grid">
|
||||||
|
|
|
@ -19,8 +19,8 @@ public class ModPanelPage : BaseLayout
|
||||||
if (user == null) return this.Redirect("~/login");
|
if (user == null) return this.Redirect("~/login");
|
||||||
if (!user.IsModerator) return this.NotFound();
|
if (!user.IsModerator) return this.NotFound();
|
||||||
|
|
||||||
this.Statistics.Add(new AdminPanelStatistic("Reports", await StatisticsHelper.ReportCount(), "/modPanel/reports/0"));
|
this.Statistics.Add(new AdminPanelStatistic("Reports", await StatisticsHelper.ReportCount(), "/moderation/reports/0"));
|
||||||
this.Statistics.Add(new AdminPanelStatistic("Cases", await StatisticsHelper.CaseCount(), "/modPanel/cases/0"));
|
this.Statistics.Add(new AdminPanelStatistic("Cases", await StatisticsHelper.CaseCount(), "/moderation/cases/0"));
|
||||||
|
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@page "/modPanel/reports/{pageNumber:int}"
|
@page "/moderation/reports/{pageNumber:int}"
|
||||||
@using LBPUnion.ProjectLighthouse.Administration.Reports
|
@using LBPUnion.ProjectLighthouse.Administration.Reports
|
||||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.ReportsPage
|
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.ReportsPage
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<p>There are @Model.ReportCount total reports.</p>
|
<p>There are @Model.ReportCount total reports.</p>
|
||||||
|
|
||||||
<form action="/modPanel/reports/0">
|
<form action="/moderation/reports/0">
|
||||||
<div class="ui icon input">
|
<div class="ui icon input">
|
||||||
<input type="text" name="name" placeholder="Search reports..." value="@Model.SearchValue">
|
<input type="text" name="name" placeholder="Search reports..." value="@Model.SearchValue">
|
||||||
<i class="search icon"></i>
|
<i class="search icon"></i>
|
||||||
|
@ -69,11 +69,11 @@
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<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>
|
<i class="checkmark icon"></i>
|
||||||
<span>Dismiss</span>
|
<span>Dismiss</span>
|
||||||
</a>
|
</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>
|
<i class="trash icon"></i>
|
||||||
<span>Remove all related assets</span>
|
<span>Remove all related assets</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -239,10 +239,10 @@
|
||||||
|
|
||||||
@if (Model.PageNumber != 0)
|
@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)
|
@(Model.PageNumber + 1) / @(Model.PageAmount)
|
||||||
@if (Model.PageNumber < Model.PageAmount - 1)
|
@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>
|
||||||
}
|
}
|
|
@ -28,7 +28,7 @@ public class ReportsPage : BaseLayout
|
||||||
{
|
{
|
||||||
User? user = this.Database.UserFromWebRequest(this.Request);
|
User? user = this.Database.UserFromWebRequest(this.Request);
|
||||||
if (user == null) return this.Redirect("~/login");
|
if (user == null) return this.Redirect("~/login");
|
||||||
if (!user.IsAdmin) return this.NotFound();
|
if (!user.IsModerator) return this.NotFound();
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(name)) name = "";
|
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));
|
this.PageAmount = Math.Max(1, (int)Math.Ceiling((double)this.ReportCount / ServerStatics.PageSize));
|
||||||
|
|
||||||
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount)
|
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)
|
this.Reports = await this.Database.Reports.Include(r => r.ReportingPlayer)
|
||||||
.Where(r => r.ReportingPlayer.Username.Contains(this.SearchValue))
|
.Where(r => r.ReportingPlayer.Username.Contains(this.SearchValue))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@page "/modPanel/cases/{pageNumber:int}"
|
@page "/moderation/cases/{pageNumber:int}"
|
||||||
@using LBPUnion.ProjectLighthouse.Administration
|
@using LBPUnion.ProjectLighthouse.Administration
|
||||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.CasePage
|
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.CasePage
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
}
|
}
|
||||||
else if(Model.User.IsModerator)
|
else if(Model.User.IsModerator)
|
||||||
{
|
{
|
||||||
Model.NavigationItemsRight.Add(new PageNavigationItem("Mod Panel", "/modPanel", "user shield"));
|
Model.NavigationItemsRight.Add(new PageNavigationItem("Mod Panel", "/moderation", "user shield"));
|
||||||
}
|
}
|
||||||
Model.NavigationItemsRight.Add(new PageNavigationItem("Log out", "/logout", "user alternate slash")); // should always be last
|
Model.NavigationItemsRight.Add(new PageNavigationItem("Log out", "/logout", "user alternate slash")); // should always be last
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue