From 637cc0cfa4d1430d39619e061815836967f36a16 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 8 Nov 2025 13:21:29 +0800 Subject: [PATCH] :zap: Prevent from loading nested replied post --- DysonNetwork.Sphere/Post/PostController.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/DysonNetwork.Sphere/Post/PostController.cs b/DysonNetwork.Sphere/Post/PostController.cs index 6a5ca61..28360da 100644 --- a/DysonNetwork.Sphere/Post/PostController.cs +++ b/DysonNetwork.Sphere/Post/PostController.cs @@ -221,7 +221,7 @@ public class PostController( var posts = await query.Skip(offset).Take(take).ToListAsync(); foreach (var post in posts) { - // Prevent load nested replied post + // Prevent to load nested replied post if (post.RepliedPost != null) post.RepliedPost.RepliedPost = null; } @@ -483,11 +483,9 @@ public class PostController( var postsId = posts.Select(e => e.Id).ToList(); var reactionMaps = await ps.GetPostReactionMapBatch(postsId); foreach (var post in posts) - { post.ReactionsCount = reactionMaps.TryGetValue(post.Id, out var count) ? count : new Dictionary(); - } Response.Headers["X-Total"] = totalCount.ToString(); @@ -603,7 +601,7 @@ public class PostController( !await rs.IsMemberWithRole( realm.Id, accountId, - [RealmMemberRole.Normal] + new List { RealmMemberRole.Normal } ) ) return StatusCode(403, "You are not a member of this realm."); @@ -1174,4 +1172,4 @@ public class PostController( return NoContent(); } -} \ No newline at end of file +}