🛂 Stricter post visibility check

This commit is contained in:
2025-10-24 00:02:27 +08:00
parent 266b9e36e2
commit 4ba6206c9d
3 changed files with 77 additions and 64 deletions

View File

@@ -106,7 +106,7 @@ public class ActivityService(
var userRealms = await rs.GetUserRealms(Guid.Parse(currentUser.Id));
// Build and execute the posts query
// Build and execute the post query
var postsQuery = BuildPostsQuery(cursor, filteredPublishersId, userRealms);
// Apply visibility filtering and execute
@@ -122,12 +122,9 @@ public class ActivityService(
var posts = await GetAndProcessPosts(
postsQuery,
currentUser,
userFriends,
userPublishers,
trackViews: true);
if (currentUser != null)
await LoadPostsRealmsAsync(posts, rs);
await LoadPostsRealmsAsync(posts, rs);
posts = RankPosts(posts, take);
@@ -283,8 +280,6 @@ public class ActivityService(
private async Task<List<SnPost>> GetAndProcessPosts(
IQueryable<SnPost> baseQuery,
Account? currentUser = null,
List<Guid>? userFriends = null,
List<Shared.Models.SnPublisher>? userPublishers = null,
bool trackViews = true)
{
var posts = await baseQuery.ToListAsync();