diff --git a/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs b/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs index dae7c17e..ec8f8481 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/Admin/AdminUserController.cs @@ -96,8 +96,7 @@ public class AdminUserController : ControllerBase Logger.Error($"Failed to delete planet resource {hash}\n{e}", LogArea.Admin); } } - - this.database.Cases.Add(ModerationCase.NewPlanetDeletionCase(user.UserId, targetedUser.UserId)); + await this.database.SaveChangesAsync(); return this.Redirect($"/user/{targetedUser.UserId}"); diff --git a/ProjectLighthouse.Servers.Website/Controllers/Admin/ModerationSlotController.cs b/ProjectLighthouse.Servers.Website/Controllers/Admin/ModerationSlotController.cs index 7cfbba56..e67e7bf3 100644 --- a/ProjectLighthouse.Servers.Website/Controllers/Admin/ModerationSlotController.cs +++ b/ProjectLighthouse.Servers.Website/Controllers/Admin/ModerationSlotController.cs @@ -28,7 +28,6 @@ public class ModerationSlotController : ControllerBase Slot? slot = await this.database.Slots.FirstOrDefaultAsync(s => s.SlotId == id); if (slot == null) return this.NotFound(); slot.TeamPick = true; - this.database.Cases.Add(ModerationCase.NewTeamPickCase(user.UserId, slot.SlotId, true)); await this.database.SaveChangesAsync(); return this.Ok(); @@ -43,7 +42,6 @@ public class ModerationSlotController : ControllerBase Slot? slot = await this.database.Slots.FirstOrDefaultAsync(s => s.SlotId == id); if (slot == null) return this.NotFound(); slot.TeamPick = false; - this.database.Cases.Add(ModerationCase.NewTeamPickCase(user.UserId, slot.SlotId, false)); await this.database.SaveChangesAsync(); return this.Ok(); @@ -59,7 +57,6 @@ 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(); } diff --git a/ProjectLighthouse.Servers.Website/Pages/Partials/ModerationCasePartial.cshtml b/ProjectLighthouse.Servers.Website/Pages/Partials/ModerationCasePartial.cshtml index eafc5a4c..8c804aa3 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Partials/ModerationCasePartial.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Partials/ModerationCasePartial.cshtml @@ -44,4 +44,6 @@ { No description was provided. } + + \ No newline at end of file diff --git a/ProjectLighthouse/Administration/CaseType.cs b/ProjectLighthouse/Administration/CaseType.cs index 3cc34938..4f1494da 100644 --- a/ProjectLighthouse/Administration/CaseType.cs +++ b/ProjectLighthouse/Administration/CaseType.cs @@ -1,6 +1,6 @@ namespace LBPUnion.ProjectLighthouse.Administration; -// Next available ID for use: 18 +// Next available ID for use: 7 // PLEASE UPDATE THIS WHEN YOU ADD SOMETHING HERE! // IF YOU DO NOT ADD THIS IN ORDER PROPERLY THEN THERE WILL BE DATA CORRUPTION! // THE VALUE MUST ALWAYS BE EXPLICITLY SET. @@ -9,25 +9,11 @@ public enum CaseType UserSilence = 0, UserRestriction = 1, UserBan = 2, - UserDeletion = 3, - UserCommentsDisabled = 4, - UserDetailsEdited = 5, - UserPlanetsDeletion = 6, + UserCommentsDisabled = 3, - LevelDeletion = 7, - LevelLock = 8, - LevelCommentsDisabled = 9, - LevelDetailsEdited = 10, - LevelTeamPickAdded = 16, - LevelTeamPickRemoved = 17, - - CommentDeletion = 11, - ReviewDeletion = 12, - PhotoDeletion = 13, - - HashModeration = 14, - - IpAddressBan = 15, + LevelLock = 4, + LevelCommentsDisabled = 5, + LevelDetailsEdited = 6, } public static class CaseTypeExtensions @@ -36,13 +22,10 @@ public static class CaseTypeExtensions { return type switch { - CaseType.UserDeletion => false, // you cant get a user from a deleted id CaseType.UserSilence => true, CaseType.UserRestriction => true, CaseType.UserBan => true, CaseType.UserCommentsDisabled => true, - CaseType.UserDetailsEdited => true, - CaseType.UserPlanetsDeletion => true, _ => false, }; } @@ -51,12 +34,9 @@ public static class CaseTypeExtensions { return type switch { - CaseType.LevelDeletion => false, // you cant get a slot from a deleted id CaseType.LevelLock => true, CaseType.LevelCommentsDisabled => true, CaseType.LevelDetailsEdited => true, - CaseType.LevelTeamPickAdded => true, - CaseType.LevelTeamPickRemoved => true, _ => false, }; } diff --git a/ProjectLighthouse/Administration/ModerationCase.cs b/ProjectLighthouse/Administration/ModerationCase.cs index 2c392cea..1f7d2331 100644 --- a/ProjectLighthouse/Administration/ModerationCase.cs +++ b/ProjectLighthouse/Administration/ModerationCase.cs @@ -47,24 +47,7 @@ public class ModerationCase #region Case creators #region Level - public static ModerationCase NewTeamPickCase(int caseCreator, int slotId, bool added) - => new() - { - CaseType = added ? CaseType.LevelTeamPickAdded : CaseType.LevelTeamPickRemoved, - CaseDescription = "", - CaseCreatorId = caseCreator, - CaseCreated = DateTime.Now, - AffectedId = slotId, - }; - public static ModerationCase NewLevelDeletionCase(int caseCreator, int slotId) - => new() - { - CaseType = CaseType.LevelDeletion, - CaseDescription = "Deleted slot ID " + slotId, - CaseCreatorId = caseCreator, - CaseCreated = DateTime.Now, - }; #endregion #region User @@ -79,25 +62,6 @@ public class ModerationCase AffectedId = userId, }; - public static ModerationCase NewAccountDeletionCase(int caseCreator, int userId) - => new() - { - CaseType = CaseType.UserDeletion, - CaseDescription = "Deleted user ID " + userId, - CaseCreatorId = caseCreator, - CaseCreated = DateTime.Now, - }; - - public static ModerationCase NewPlanetDeletionCase(int caseCreator, int userId) - => new() - { - CaseType = CaseType.UserPlanetsDeletion, - CaseDescription = "", - CaseCreatorId = caseCreator, - CaseCreated = DateTime.Now, - AffectedId = userId, - }; - #endregion #endregion } \ No newline at end of file