mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-13 13:22:28 +00:00
Feature/user blocking hotfix 1 (#668)
* Changed CommentController to use an AsyncEnumerable to attempt to fix the current issue * Made comments & reviews from blocked users on levels not appear
This commit is contained in:
parent
3fcfaaf5cc
commit
96c34c83a7
2 changed files with 19 additions and 9 deletions
|
@ -71,16 +71,17 @@ public class CommentController : ControllerBase
|
|||
|
||||
if (targetId == 0) return this.NotFound();
|
||||
|
||||
List<int> blockedUsers = await (
|
||||
from blockedProfile in this.database.BlockedProfiles
|
||||
where blockedProfile.UserId == token.UserId
|
||||
select blockedProfile.BlockedUserId
|
||||
).ToListAsync();
|
||||
|
||||
List<int> blockedUsers = await (
|
||||
from blockedProfile in this.database.BlockedProfiles
|
||||
where blockedProfile.UserId == token.UserId
|
||||
select blockedProfile.BlockedUserId).ToListAsync();
|
||||
|
||||
List<Comment> comments = await this.database.Comments.Include(c => c.Poster)
|
||||
.Where(c => c.TargetId == targetId && c.Type == type && !c.Poster.IsBanned)
|
||||
.Where(c => !blockedUsers.Contains(c.PosterUserId))
|
||||
.OrderByDescending(c => c.Timestamp)
|
||||
.OrderByDescending(p => p.Timestamp)
|
||||
.Where(p => p.TargetId == targetId && p.Type == type)
|
||||
.ToAsyncEnumerable()
|
||||
.Where(p => !p.Poster.IsBanned)
|
||||
.Where(p => !blockedUsers.Contains(p.PosterUserId))
|
||||
.Skip(Math.Max(0, pageStart - 1))
|
||||
.Take(Math.Min(pageSize, 30))
|
||||
.ToListAsync();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue