def autofollow_bootstrap_timeline_accounts!
bootstrap_timeline_accounts.each do |target_account|
- FollowService.new.call(@source_account, target_account)
+ begin
+ FollowService.new.call(@source_account, target_account)
+ rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError
+ nil
+ end
end
end
def local_unlocked_accounts(usernames)
Account.local
+ .without_suspended
.where(username: usernames)
.where(locked: false)
+ .where(moved_to_account_id: nil)
end
end
context 'when setting is set' do
let!(:alice) { Fabricate(:account, username: 'alice') }
let!(:bob) { Fabricate(:account, username: 'bob') }
+ let!(:eve) { Fabricate(:account, username: 'eve', suspended: true) }
before do
- Setting.bootstrap_timeline_accounts = 'alice, bob'
+ Setting.bootstrap_timeline_accounts = 'alice, @bob, eve, unknown'
subject.call(source_account)
end
expect(source_account.following?(alice)).to be true
expect(source_account.following?(bob)).to be true
end
+
+ it 'does not follow suspended account' do
+ expect(source_account.following?(eve)).to be false
+ end
end
end
end