Fix cross-user comments, only show slots by user on planet

This commit is contained in:
jvyden 2021-10-19 18:17:12 -04:00
commit 4c97972143
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
2 changed files with 3 additions and 1 deletions

View file

@ -22,6 +22,7 @@ namespace ProjectLighthouse.Controllers {
public async Task<IActionResult> GetComments(string username) {
List<Comment> comments = await database.Comments
.Include(c => c.Target)
.Include(c => c.Poster)
.Where(c => c.Target.Username == username)
.ToListAsync();

View file

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