Add the ability for moderators to forcibly lock levels (#831)

* Add the ability for moderators to forcibly lock levels

* Prevent forcibly locking an already locked level

I had to rollback and re-commit this because I was getting some weird error within Rider.

* Correct moderation notice header styling & remove errant text
This commit is contained in:
koko 2023-07-07 18:44:05 -04:00 committed by GitHub
parent df4d717763
commit 25bb2ecfc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 114 additions and 13 deletions

View file

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