diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs index e1b4c9b0..e29f3fe0 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs @@ -240,6 +240,12 @@ public class PublishController : ControllerBase oldSlot.MinimumPlayers = Math.Clamp(slot.MinimumPlayers, 1, 4); oldSlot.MaximumPlayers = Math.Clamp(slot.MaximumPlayers, 1, 4); + + // Check if the level has been locked by a moderator to avoid unlocking it + if (oldSlot.LockedByModerator) + { + oldSlot.InitiallyLocked = true; + } await this.database.SaveChangesAsync(); return this.Ok(SlotBase.CreateFromEntity(oldSlot, token)); diff --git a/ProjectLighthouse.Servers.Website/Pages/SlotPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/SlotPage.cshtml index dbfe7235..78b0a919 100644 --- a/ProjectLighthouse.Servers.Website/Pages/SlotPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/SlotPage.cshtml @@ -26,12 +26,32 @@ @if (Model.Slot!.Hidden) {
Only you and moderators may view this level.
- - Reason: "@Model.Slot.HiddenReason" - -For more information please contact a moderator.
+This level has been hidden for violating the Terms of Service. Remember to follow the rules!
+ } +This level has been locked for violating the Terms of Service. Remember to follow the rules!
+ }- Only you and other moderators may view the ban reason. -
+ "@Model.ProfileUser.BannedReason" } else { diff --git a/ProjectLighthouse/Administration/Maintenance/RepeatingTasks/PerformCaseActionsTask.cs b/ProjectLighthouse/Administration/Maintenance/RepeatingTasks/PerformCaseActionsTask.cs index a0d9d91c..ff857ce5 100644 --- a/ProjectLighthouse/Administration/Maintenance/RepeatingTasks/PerformCaseActionsTask.cs +++ b/ProjectLighthouse/Administration/Maintenance/RepeatingTasks/PerformCaseActionsTask.cs @@ -77,6 +77,13 @@ public class PerformCaseActionsTask : IRepeatingTask slot!.CommentsEnabled = true; break; } + case CaseType.LevelLock: + { + slot!.InitiallyLocked = false; + slot.LockedByModerator = false; + slot.LockedReason = ""; + break; + } default: throw new ArgumentOutOfRangeException(); } } @@ -121,6 +128,13 @@ public class PerformCaseActionsTask : IRepeatingTask slot!.CommentsEnabled = false; break; } + case CaseType.LevelLock: + { + slot!.InitiallyLocked = true; + slot.LockedByModerator = true; + slot.LockedReason = @case.Reason; + break; + } default: throw new ArgumentOutOfRangeException(); } } diff --git a/ProjectLighthouse/Migrations/20230707125059_AddModerationLevelLocks.cs b/ProjectLighthouse/Migrations/20230707125059_AddModerationLevelLocks.cs new file mode 100644 index 00000000..b9bee259 --- /dev/null +++ b/ProjectLighthouse/Migrations/20230707125059_AddModerationLevelLocks.cs @@ -0,0 +1,41 @@ +using LBPUnion.ProjectLighthouse.Database; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace ProjectLighthouse.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20230707125059_AddModerationLevelLocks")] + public partial class AddModerationLevelLocks : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn