mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-06 02:32:28 +00:00
Add mod notes to ban cases, improve case display
This commit is contained in:
parent
cdcc03fdc1
commit
7ba50e26f5
6 changed files with 30 additions and 18 deletions
|
@ -59,6 +59,7 @@ public class ModerationSlotController : ControllerBase
|
||||||
if (slot == null) return this.Ok();
|
if (slot == null) return this.Ok();
|
||||||
|
|
||||||
await this.database.RemoveSlot(slot);
|
await this.database.RemoveSlot(slot);
|
||||||
|
this.database.Cases.Add(ModerationCase.NewLevelDeletionCase(user.UserId, slot.SlotId));
|
||||||
|
|
||||||
return this.Ok();
|
return this.Ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,17 @@
|
||||||
<div class="ui left labeled input">
|
<div class="ui left labeled input">
|
||||||
<label for="text" class="ui blue label">Reason: </label>
|
<label for="text" class="ui blue label">Reason: </label>
|
||||||
<input type="text" name="reason" id="text">
|
<input type="text" name="reason" id="text">
|
||||||
</div><br>
|
</div><br><br>
|
||||||
|
|
||||||
|
<div class="ui left labeled input">
|
||||||
|
<label for="modNotes" class="ui blue label">Moderation case notes: </label>
|
||||||
|
<input type="text" name="modNotes" id="modNotes">
|
||||||
|
</div><br><br>
|
||||||
|
|
||||||
<div class="ui left labeled input">
|
<div class="ui left labeled input">
|
||||||
<label for="caseExpires" class="ui blue label">Expires on: </label>
|
<label for="caseExpires" class="ui blue label">Expires on: </label>
|
||||||
<input type="datetime-local" name="caseExpires" id="caseExpires">
|
<input type="datetime-local" name="caseExpires" id="caseExpires">
|
||||||
</div><br>
|
</div><br><br>
|
||||||
|
|
||||||
<br><input type="submit" value="Yes, ban @Model.TargetedUser.Username!" id="submit" class="ui red button"><br>
|
<br><input type="submit" value="Yes, ban @Model.TargetedUser.Username!" id="submit" class="ui red button"><br>
|
||||||
</form>
|
</form>
|
|
@ -26,7 +26,7 @@ public class ModeratorBanUserPage : BaseLayout
|
||||||
return this.Page();
|
return this.Page();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> OnPost([FromRoute] int id, string reason, DateTime caseExpires)
|
public async Task<IActionResult> OnPost([FromRoute] int id, string reason, string modNotes, DateTime caseExpires)
|
||||||
{
|
{
|
||||||
User? user = this.Database.UserFromWebRequest(this.Request);
|
User? user = this.Database.UserFromWebRequest(this.Request);
|
||||||
if (user == null || !user.IsModerator) return this.NotFound();
|
if (user == null || !user.IsModerator) return this.NotFound();
|
||||||
|
@ -44,7 +44,7 @@ public class ModeratorBanUserPage : BaseLayout
|
||||||
this.Database.WebTokens.RemoveRange(this.Database.WebTokens.Where(t => t.UserId == this.TargetedUser.UserId));
|
this.Database.WebTokens.RemoveRange(this.Database.WebTokens.Where(t => t.UserId == this.TargetedUser.UserId));
|
||||||
|
|
||||||
// generate & add moderation case
|
// generate & add moderation case
|
||||||
this.Database.Add(ModerationCase.NewBanCase(user.UserId, this.TargetedUser.UserId, reason, caseExpires));
|
this.Database.Add(ModerationCase.NewBanCase(user.UserId, this.TargetedUser.UserId, reason, modNotes, caseExpires));
|
||||||
|
|
||||||
await this.Database.SaveChangesAsync();
|
await this.Database.SaveChangesAsync();
|
||||||
return this.Redirect($"/user/{this.TargetedUser.UserId}");
|
return this.Redirect($"/user/{this.TargetedUser.UserId}");
|
||||||
|
|
|
@ -18,16 +18,12 @@
|
||||||
This case expired on @Model.CaseExpires!.Value.ToString("MM/dd/yyyy @ h:mm tt").
|
This case expired on @Model.CaseExpires!.Value.ToString("MM/dd/yyyy @ h:mm tt").
|
||||||
</h3>
|
</h3>
|
||||||
}
|
}
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
Case created by <a href="/user/@Model.CaseCreator!.UserId">@Model.CaseCreator.Username</a>
|
Case created by <a href="/user/@Model.CaseCreator!.UserId">@Model.CaseCreator.Username</a>
|
||||||
on @Model.CaseCreated.ToString("MM/dd/yyyy @ h:mm tt")
|
on @Model.CaseCreated.ToString("MM/dd/yyyy @ h:mm tt")
|
||||||
</span><br>
|
</span><br>
|
||||||
|
|
||||||
<span>
|
|
||||||
<strong>Description:</strong> @Model.CaseDescription
|
|
||||||
</span><br>
|
|
||||||
|
|
||||||
@if (Model.CaseType.AffectsLevel())
|
@if (Model.CaseType.AffectsLevel())
|
||||||
{
|
{
|
||||||
Slot slot = await Model.GetSlotAsync(database);
|
Slot slot = await Model.GetSlotAsync(database);
|
||||||
|
@ -38,4 +34,14 @@
|
||||||
User user = await Model.GetUserAsync(database);
|
User user = await Model.GetUserAsync(database);
|
||||||
<p><strong>Affected user:</strong> <a href="/user/@user.UserId">@user.Username</a></p>
|
<p><strong>Affected user:</strong> <a href="/user/@user.UserId">@user.Username</a></p>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(Model.CaseDescription))
|
||||||
|
{
|
||||||
|
<h3>Description</h3>
|
||||||
|
<pre>@Model.CaseDescription</pre>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<b>No description was provided.</b>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
|
@ -17,14 +17,14 @@
|
||||||
{
|
{
|
||||||
<div class="ui inverted red segment">
|
<div class="ui inverted red segment">
|
||||||
<h2>User is currently banned!</h2>
|
<h2>User is currently banned!</h2>
|
||||||
@if (Model.User != null && Model.User.IsAdmin)
|
@if (Model.User != null && Model.User.IsModerator)
|
||||||
{
|
{
|
||||||
<b>Reason:</b>
|
<b>Reason:</b>
|
||||||
<span>"@Model.ProfileUser.BannedReason"</span>
|
<span>"@Model.ProfileUser.BannedReason"</span>
|
||||||
<p>
|
<p>
|
||||||
<i>Note: Only you and other admins may view the ban reason.</i>
|
<i>Note: Only you and other admins may view the ban reason.</i>
|
||||||
</p>
|
</p>
|
||||||
<a class="ui inverted button" href="/admin/user/@Model.ProfileUser.UserId/unban">
|
<a class="ui inverted button" href="/moderation/user/@Model.ProfileUser.UserId/unban">
|
||||||
<i class="ban icon"></i>
|
<i class="ban icon"></i>
|
||||||
<span>Unban User</span>
|
<span>Unban User</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
<div class="eight wide column">
|
<div class="eight wide column">
|
||||||
<div class="ui red segment">
|
<div class="ui red segment">
|
||||||
<h2>Recent Activity</h2>
|
<h2>Recent Activity</h2>
|
||||||
<p>Coming soon!</p>
|
<p>Coming soon?</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -118,10 +118,10 @@
|
||||||
|
|
||||||
@await Html.PartialAsync("Partials/CommentsPartial")
|
@await Html.PartialAsync("Partials/CommentsPartial")
|
||||||
|
|
||||||
@if (Model.User != null && Model.User.IsAdmin)
|
@if (Model.User != null && Model.User.IsModerator)
|
||||||
{
|
{
|
||||||
<div class="ui yellow segment">
|
<div class="ui green segment">
|
||||||
<h2>Admin Options</h2>
|
<h2>Moderator Options</h2>
|
||||||
|
|
||||||
@if (!Model.ProfileUser.IsBanned)
|
@if (!Model.ProfileUser.IsBanned)
|
||||||
{
|
{
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<a class="ui red button" href="/admin/user/@Model.ProfileUser.UserId/wipePlanets">
|
<a class="ui red button" href="/moderation/user/@Model.ProfileUser.UserId/wipePlanets">
|
||||||
<i class="trash alternate icon"></i>
|
<i class="trash alternate icon"></i>
|
||||||
<span>Wipe user's earth decorations</span>
|
<span>Wipe user's earth decorations</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -68,11 +68,11 @@ public class ModerationCase
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region User
|
#region User
|
||||||
public static ModerationCase NewBanCase(int caseCreator, int userId, string reason, DateTime caseExpires)
|
public static ModerationCase NewBanCase(int caseCreator, int userId, string reason, string modNotes, DateTime caseExpires)
|
||||||
=> new()
|
=> new()
|
||||||
{
|
{
|
||||||
CaseType = CaseType.UserBan,
|
CaseType = CaseType.UserBan,
|
||||||
CaseDescription = $"Banned for reason '{reason}'",
|
CaseDescription = $"Banned for reason '{reason}'\nModeration notes: {modNotes}",
|
||||||
CaseCreatorId = caseCreator,
|
CaseCreatorId = caseCreator,
|
||||||
CaseCreated = DateTime.Now,
|
CaseCreated = DateTime.Now,
|
||||||
CaseExpires = caseExpires,
|
CaseExpires = caseExpires,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue