Add mod notes to ban cases, improve case display

This commit is contained in:
jvyden 2022-07-27 17:53:20 -04:00
commit 7ba50e26f5
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
6 changed files with 30 additions and 18 deletions

View file

@ -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>

View file

@ -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}");