mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-10-05 15:49:37 +00:00
Merge branch 'main' into recent-activity
# Conflicts: # .config/dotnet-tools.json # ProjectLighthouse.Servers.Website/Pages/Partials/ReviewPartial.cshtml
This commit is contained in:
commit
8f91875f7c
54 changed files with 459 additions and 48 deletions
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
|
@ -92,6 +93,9 @@ public class ReviewController : ControllerBase
|
|||
{
|
||||
GameTokenEntity token = this.GetToken();
|
||||
|
||||
// Deny request if in read-only mode
|
||||
if (ServerConfiguration.Instance.UserGeneratedContentLimits.ReadOnlyMode) return this.BadRequest();
|
||||
|
||||
GameReview? newReview = await this.DeserializeBody<GameReview>();
|
||||
if (newReview == null) return this.BadRequest();
|
||||
|
||||
|
@ -115,7 +119,7 @@ public class ReviewController : ControllerBase
|
|||
}
|
||||
review.Thumb = Math.Clamp(newReview.Thumb, -1, 1);
|
||||
review.LabelCollection = LabelHelper.RemoveInvalidLabels(newReview.LabelCollection);
|
||||
|
||||
|
||||
review.Text = newReview.Text;
|
||||
review.Deleted = false;
|
||||
review.Timestamp = TimeHelper.TimestampMillis;
|
||||
|
@ -255,6 +259,9 @@ public class ReviewController : ControllerBase
|
|||
{
|
||||
GameTokenEntity token = this.GetToken();
|
||||
|
||||
// Deny request if in read-only mode
|
||||
if (ServerConfiguration.Instance.UserGeneratedContentLimits.ReadOnlyMode) return this.BadRequest();
|
||||
|
||||
int creatorId = await this.database.Slots.Where(s => s.SlotId == slotId).Select(s => s.CreatorId).FirstOrDefaultAsync();
|
||||
if (creatorId == 0) return this.BadRequest();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue