DismissReport([FromRoute] int id)
+ {
+ User? user = this.database.UserFromWebRequest(this.Request);
+ if (user == null || !user.IsAdmin) return this.StatusCode(403, "");
+
+ GriefReport? report = await this.database.Reports.FirstOrDefaultAsync(r => r.ReportId == id);
+ if (report == null) return this.NotFound();
+
+ if (System.IO.File.Exists(Path.Combine("png", $"{report.JpegHash}.png")))
+ {
+ System.IO.File.Delete(Path.Combine("png", $"{report.JpegHash}.png"));
+ }
+ if (System.IO.File.Exists(Path.Combine("r", report.JpegHash)))
+ {
+ System.IO.File.Delete(Path.Combine("r", report.JpegHash));
+ }
+
+ this.database.Reports.Remove(report);
+
+ await this.database.SaveChangesAsync();
+
+ return this.Redirect("~/admin/reports/0");
+ }
}
\ No newline at end of file
diff --git a/ProjectLighthouse/Pages/ReportsPage.cshtml b/ProjectLighthouse/Pages/ReportsPage.cshtml
index 116debe3..bd8ea8f4 100644
--- a/ProjectLighthouse/Pages/ReportsPage.cshtml
+++ b/ProjectLighthouse/Pages/ReportsPage.cshtml
@@ -15,7 +15,9 @@
+
+
+
@foreach (GriefReport report in Model.Reports)
{
@@ -30,9 +33,16 @@
-

+
- Report submitted by @report.ReportingPlayer.Username
+
+
+ Report submitted by
+
+ @report.ReportingPlayer.Username
+
+
+
Report contains @report.XmlPlayers.Length @(report.XmlPlayers.Length == 1 ? "player" : "players")
@foreach (ReportPlayer player in report.XmlPlayers)
{
@@ -40,14 +50,32 @@
@player.Name
}
- Report time: @(DateTimeOffset.FromUnixTimeMilliseconds(report.Timestamp).ToString("R"))
- Report reason: @report.Type
- Level ID: @report.LevelId
- Level type: @report.LevelType
- Level owner: @report.LevelOwner
- Hover to see reported region
-
-
+
+
+
+ Report time: @(DateTimeOffset.FromUnixTimeMilliseconds(report.Timestamp).ToString("R"))
+
+
+ Report reason: @report.Type
+
+
+ Level ID: @report.LevelId
+
+
+ Level type: @report.LevelType
+
+
+ Level owner: @report.LevelOwner
+
+
+
+
+
+ Dismiss
+
+
+
+ Remove all related assets
}
+