Remove blocked users from ActivityPub replies collection

pull/18468/head
Claire 3 years ago
parent fe6511ee45
commit ebf34263d7

@ -30,7 +30,12 @@ class ActivityPub::RepliesController < ActivityPub::BaseController
end
def set_replies
@replies = only_other_accounts? ? Status.where.not(account_id: @account.id).joins(:account).merge(Account.without_suspended) : @account.statuses
if only_other_accounts?
@replies = Status.where.not(account_id: @account.id).joins(:account).merge(Account.without_suspended)
@replies = @replies.joins("LEFT JOIN blocks ON blocks.account_id = #{@account.id} AND blocks.target_account_id = statuses.account_id").where(blocks: { id: nil })
else
@replies = @account.statuses
end
@replies = @replies.distributable_visibility.where(in_reply_to_id: @status.id)
@replies = @replies.paginate_by_min_id(DESCENDANTS_LIMIT, params[:min_id])
end

Loading…
Cancel
Save