mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-07 11:12:27 +00:00
Reduce CaseTypes to those that can be temporary
This commit is contained in:
parent
e45a93dc33
commit
b3d91fd470
5 changed files with 8 additions and 66 deletions
|
@ -97,7 +97,6 @@ public class AdminUserController : ControllerBase
|
|||
}
|
||||
}
|
||||
|
||||
this.database.Cases.Add(ModerationCase.NewPlanetDeletionCase(user.UserId, targetedUser.UserId));
|
||||
await this.database.SaveChangesAsync();
|
||||
|
||||
return this.Redirect($"/user/{targetedUser.UserId}");
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -44,4 +44,6 @@
|
|||
{
|
||||
<b>No description was provided.</b>
|
||||
}
|
||||
|
||||
<a href="/moderation/case/@Model.CaseId/expire"></a>
|
||||
</div>
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue