mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-13 13:22:28 +00:00
Add ability to hide comments on levels and profiles
This commit is contained in:
parent
0b8c0cbfb4
commit
8fe9bd4c57
12 changed files with 123 additions and 16 deletions
|
@ -58,6 +58,19 @@ public class CommentController : ControllerBase
|
|||
|
||||
if (type == CommentType.Level && slotType == "developer") targetId = await SlotHelper.GetPlaceholderSlotId(this.database, slotId, SlotType.Developer);
|
||||
|
||||
if (type == CommentType.Profile)
|
||||
{
|
||||
User? profile = await this.database.Users.FirstOrDefaultAsync(s => s.UserId == targetId);
|
||||
if (profile == null) return this.BadRequest();
|
||||
if (!profile.CommentsEnabled) return this.NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
Slot? slot = await this.database.Slots.FirstOrDefaultAsync(s => s.SlotId == targetId);
|
||||
if (slot == null) return this.BadRequest();
|
||||
if (!slot.CommentsEnabled) return this.NotFound();
|
||||
}
|
||||
|
||||
List<Comment> comments = await this.database.Comments.Include
|
||||
(c => c.Poster)
|
||||
.Where(c => c.TargetId == targetId && c.Type == type)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue