From 4c97972143028cd047b34c36f8ca684e8f60bb16 Mon Sep 17 00:00:00 2001 From: jvyden Date: Tue, 19 Oct 2021 18:17:12 -0400 Subject: [PATCH] Fix cross-user comments, only show slots by user on planet --- ProjectLighthouse/Controllers/CommentController.cs | 1 + ProjectLighthouse/Controllers/SlotsController.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ProjectLighthouse/Controllers/CommentController.cs b/ProjectLighthouse/Controllers/CommentController.cs index 1b251917..a1f056fc 100644 --- a/ProjectLighthouse/Controllers/CommentController.cs +++ b/ProjectLighthouse/Controllers/CommentController.cs @@ -22,6 +22,7 @@ namespace ProjectLighthouse.Controllers { public async Task GetComments(string username) { List comments = await database.Comments .Include(c => c.Target) + .Include(c => c.Poster) .Where(c => c.Target.Username == username) .ToListAsync(); diff --git a/ProjectLighthouse/Controllers/SlotsController.cs b/ProjectLighthouse/Controllers/SlotsController.cs index cd8a544c..c38fcaef 100644 --- a/ProjectLighthouse/Controllers/SlotsController.cs +++ b/ProjectLighthouse/Controllers/SlotsController.cs @@ -16,11 +16,12 @@ namespace ProjectLighthouse.Controllers { } [HttpGet("slots/by")] - public IActionResult SlotsBy() { + public IActionResult SlotsBy([FromQuery] string u) { string response = Enumerable.Aggregate( database.Slots .Include(s => s.Creator) .Include(s => s.Location) + .Where(s => s.Creator.Username == u) , string.Empty, (current, slot) => current + slot.Serialize()); return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "total", 1));