This commit is contained in:
Matt Jankowski 2025-09-03 20:07:43 +00:00 committed by GitHub
commit d252aaec7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 54 additions and 6 deletions

View File

@ -36,15 +36,19 @@ class FollowerAccountsController < ApplicationController
def follows
return @follows if defined?(@follows)
scope = Follow.where(target_account: @account)
scope = scope.where.not(account_id: current_account.excluded_from_timeline_account_ids) if user_signed_in?
@follows = scope.recent.page(params[:page]).per(FOLLOW_PER_PAGE).preload(:account)
@follows = passive_relationships.recent.page(params[:page]).per(FOLLOW_PER_PAGE).preload(:account)
end
def page_requested?
params[:page].present?
end
def passive_relationships
@account.passive_relationships.tap do |scope|
scope.merge! scope.where.not(account_id: current_account.excluded_from_timeline_account_ids) if user_signed_in?
end
end
def page_url(page)
ActivityPub::TagManager.instance.followers_uri_for(@account, page: page) unless page.nil?
end

View File

@ -39,15 +39,19 @@ class FollowingAccountsController < ApplicationController
def follows
return @follows if defined?(@follows)
scope = Follow.where(account: @account)
scope = scope.where.not(target_account_id: current_account.excluded_from_timeline_account_ids) if user_signed_in?
@follows = scope.recent.page(params[:page]).per(FOLLOW_PER_PAGE).preload(:target_account)
@follows = active_relationships.recent.page(params[:page]).per(FOLLOW_PER_PAGE).preload(:target_account)
end
def page_requested?
params[:page].present?
end
def active_relationships
@account.active_relationships.tap do |scope|
scope.merge! scope.where.not(target_account_id: current_account.excluded_from_timeline_account_ids) if user_signed_in?
end
end
def page_url(page)
account_following_index_url(@account, page: page) unless page.nil?
end

View File

@ -57,6 +57,26 @@ RSpec.describe FollowerAccountsController do
)
end
context 'when request is signed in and user blocks an account' do
let(:account) { Fabricate :account }
before do
Fabricate :block, account:, target_account: follower_bob
sign_in(account.user)
end
it 'returns followers without blocked' do
expect(response)
.to have_http_status(200)
expect(response.parsed_body)
.to include(
orderedItems: contain_exactly(
include(follow_from_chris.account.username)
)
)
end
end
context 'when account is permanently suspended' do
before do
alice.suspend!

View File

@ -57,6 +57,26 @@ RSpec.describe FollowingAccountsController do
)
end
context 'when request is signed in and user blocks an account' do
let(:account) { Fabricate :account }
before do
Fabricate :block, account:, target_account: followee_bob
sign_in(account.user)
end
it 'returns followers without blocked' do
expect(response)
.to have_http_status(200)
expect(response.parsed_body)
.to include(
orderedItems: contain_exactly(
include(follow_of_chris.target_account.username)
)
)
end
end
context 'when account is permanently suspended' do
before do
alice.suspend!