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) {
|
||||
|
||||
@@ -158,10 +158,11 @@ func normalizeClock(raw string) (string, error) {
|
||||
return t, nil
|
||||
}
|
||||
|
||||
// Search returns users matching the query (handle or name substring).
|
||||
// Search returns the `offset`/`limit` page of users matching the query
|
||||
// (handle or name substring) plus the total match count for pagination.
|
||||
// Used by the public user-search endpoint on the /search page.
|
||||
func (s *UserService) Search(ctx context.Context, q string, limit int) ([]model.User, error) {
|
||||
return s.users.Search(ctx, q, limit)
|
||||
func (s *UserService) Search(ctx context.Context, q string, limit, offset int) ([]model.User, int, error) {
|
||||
return s.users.Search(ctx, q, limit, offset)
|
||||
}
|
||||
|
||||
// GetReadingPrefs returns the user's reading prefs blob (opaque JSON).
|
||||
|
||||
Reference in New Issue
Block a user