fix: hide blocked user content

This commit is contained in:
Krispire Admin
2026-06-13 00:46:51 +05:30
parent 0b24ab4b45
commit 1edee92865
5 changed files with 119 additions and 22 deletions
+17
View File
@@ -296,6 +296,23 @@ func (s *SocialGraphService) Relationship(ctx context.Context, viewerID, targetI
return out, nil
}
// IsBlockedBetween reports whether a block exists in EITHER direction
// between two users — viewer→target or target→viewer. Content visibility
// is gated on this (a block either way hides the target's profile feed,
// tagged posts, and follower lists from the viewer), mirroring the
// "viewerBlocked || targetBlocked" rule RequestFollow enforces. Returns
// false for anonymous viewers (empty id) and for the self case.
func (s *SocialGraphService) IsBlockedBetween(ctx context.Context, a, b string) (bool, error) {
if a == "" || b == "" || a == b {
return false, nil
}
aBlockedB, bBlockedA, err := s.blocks.BlockState(ctx, a, b)
if err != nil {
return false, err
}
return aBlockedB || bBlockedA, nil
}
// Counts returns the accepted-follower and accepted-following totals for
// a user.
func (s *SocialGraphService) Counts(ctx context.Context, userID string) (followers, following int, err error) {