fix: hide blocked user content
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user