mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-09 11:52:27 +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();
|
||||
|
||||
await this.database.RemoveSlot(slot);
|
||||
this.database.Cases.Add(ModerationCase.NewLevelDeletionCase(user.UserId, slot.SlotId));
|
||||
|
||||
return this.Ok();
|
||||
}
|
||||
|
|
|
@ -14,12 +14,17 @@
|
|||
<div class="ui left labeled input">
|
||||
<label for="text" class="ui blue label">Reason: </label>
|
||||
<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">
|
||||
<label for="caseExpires" class="ui blue label">Expires on: </label>
|
||||
<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>
|
||||
</form>
|
|
@ -26,7 +26,7 @@ public class ModeratorBanUserPage : BaseLayout
|
|||
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);
|
||||
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));
|
||||
|
||||
// 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();
|
||||
return this.Redirect($"/user/{this.TargetedUser.UserId}");
|
||||
|
|
|
@ -24,10 +24,6 @@
|
|||
on @Model.CaseCreated.ToString("MM/dd/yyyy @ h:mm tt")
|
||||
</span><br>
|
||||
|
||||
<span>
|
||||
<strong>Description:</strong> @Model.CaseDescription
|
||||
</span><br>
|
||||
|
||||
@if (Model.CaseType.AffectsLevel())
|
||||
{
|
||||
Slot slot = await Model.GetSlotAsync(database);
|
||||
|
@ -38,4 +34,14 @@
|
|||
User user = await Model.GetUserAsync(database);
|
||||
<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>
|
|
@ -17,14 +17,14 @@
|
|||
{
|
||||
<div class="ui inverted red segment">
|
||||
<h2>User is currently banned!</h2>
|
||||
@if (Model.User != null && Model.User.IsAdmin)
|
||||
@if (Model.User != null && Model.User.IsModerator)
|
||||
{
|
||||
<b>Reason:</b>
|
||||
<span>"@Model.ProfileUser.BannedReason"</span>
|
||||
<p>
|
||||
<i>Note: Only you and other admins may view the ban reason.</i>
|
||||
</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>
|
||||
<span>Unban User</span>
|
||||
</a>
|
||||
|
@ -94,7 +94,7 @@
|
|||
<div class="eight wide column">
|
||||
<div class="ui red segment">
|
||||
<h2>Recent Activity</h2>
|
||||
<p>Coming soon!</p>
|
||||
<p>Coming soon?</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -118,10 +118,10 @@
|
|||
|
||||
@await Html.PartialAsync("Partials/CommentsPartial")
|
||||
|
||||
@if (Model.User != null && Model.User.IsAdmin)
|
||||
@if (Model.User != null && Model.User.IsModerator)
|
||||
{
|
||||
<div class="ui yellow segment">
|
||||
<h2>Admin Options</h2>
|
||||
<div class="ui green segment">
|
||||
<h2>Moderator Options</h2>
|
||||
|
||||
@if (!Model.ProfileUser.IsBanned)
|
||||
{
|
||||
|
@ -135,7 +135,7 @@
|
|||
}
|
||||
|
||||
<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>
|
||||
<span>Wipe user's earth decorations</span>
|
||||
</a>
|
||||
|
|
|
@ -68,11 +68,11 @@ public class ModerationCase
|
|||
#endregion
|
||||
|
||||
#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()
|
||||
{
|
||||
CaseType = CaseType.UserBan,
|
||||
CaseDescription = $"Banned for reason '{reason}'",
|
||||
CaseDescription = $"Banned for reason '{reason}'\nModeration notes: {modNotes}",
|
||||
CaseCreatorId = caseCreator,
|
||||
CaseCreated = DateTime.Now,
|
||||
CaseExpires = caseExpires,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue