mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-22 01:02:28 +00:00
Fix bug where users can't be deleted (#648)
* Add username to mod cases if user is deleted * Add timezone package to docker container * Remove extra space in migration sql statement * Changes from self-review
This commit is contained in:
parent
2c2f31ad38
commit
4559d26a54
15 changed files with 170 additions and 83 deletions
|
@ -21,8 +21,8 @@ public class NewCasePage : BaseLayout
|
|||
if (type == null) return this.BadRequest();
|
||||
if (affectedId == null) return this.BadRequest();
|
||||
|
||||
this.Type = (CaseType)type;
|
||||
this.AffectedId = (int)affectedId;
|
||||
this.Type = type.Value;
|
||||
this.AffectedId = affectedId.Value;
|
||||
|
||||
return this.Page();
|
||||
}
|
||||
|
@ -38,19 +38,19 @@ public class NewCasePage : BaseLayout
|
|||
reason ??= string.Empty;
|
||||
modNotes ??= string.Empty;
|
||||
|
||||
// this is fucking ugly
|
||||
// if id is invalid then return bad request
|
||||
if (!(await ((CaseType)type).IsIdValid((int)affectedId, this.Database))) return this.BadRequest();
|
||||
if (!await type.Value.IsIdValid((int)affectedId, this.Database)) return this.BadRequest();
|
||||
|
||||
ModerationCase @case = new()
|
||||
{
|
||||
Type = (CaseType)type,
|
||||
Type = type.Value,
|
||||
Reason = reason,
|
||||
ModeratorNotes = modNotes,
|
||||
ExpiresAt = expires,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatorId = user.UserId,
|
||||
AffectedId = (int)affectedId,
|
||||
CreatorUsername = user.Username,
|
||||
AffectedId = affectedId.Value,
|
||||
};
|
||||
|
||||
this.Database.Cases.Add(@case);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue