mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-09 23:01:27 +00:00
Allow moderators to moderate story levels (#809)
* Allow moderators to view story levels on website Show comments to moderators on in-game story levels that show the levels id * Only show LH ID comment on the first page
This commit is contained in:
parent
6e92ddc89f
commit
14ebad07f3
5 changed files with 66 additions and 2 deletions
|
@ -50,8 +50,13 @@ public class CommentController : ControllerBase
|
|||
{
|
||||
GameTokenEntity token = this.GetToken();
|
||||
|
||||
UserEntity? user = await this.database.UserFromGameToken(token);
|
||||
if (user == null) return this.Unauthorized();
|
||||
|
||||
if ((slotId == 0 || SlotHelper.IsTypeInvalid(slotType)) == (username == null)) return this.BadRequest();
|
||||
|
||||
int originalSlotId = slotId;
|
||||
|
||||
if (slotType == "developer") slotId = await SlotHelper.GetPlaceholderSlotId(this.database, slotId, SlotType.Developer);
|
||||
|
||||
int targetId;
|
||||
|
@ -89,6 +94,17 @@ public class CommentController : ControllerBase
|
|||
.ApplyPagination(pageData)
|
||||
.ToListAsync()).ToSerializableList(c => GameComment.CreateFromEntity(c, token.UserId));
|
||||
|
||||
if (type == CommentType.Level && slotType == "developer" && user.IsModerator && pageData.PageStart == 1)
|
||||
{
|
||||
comments.Insert(0, new GameComment
|
||||
{
|
||||
CommentId = 0,
|
||||
Timestamp = 0,
|
||||
AuthorUsername = "LH",
|
||||
Message = $"Slot ID: {targetId}, Story level ID: {originalSlotId}",
|
||||
});
|
||||
}
|
||||
|
||||
return this.Ok(new CommentListResponse(comments));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue