Fix BootstrapTimelineService crashing when bootstrapped accounts are invalid (#12037)
* Add test to handle suspended and missing users in BootstrapTimelineService * Fix BootstrapTimelineService crashing when bootstrapped accounts are invalid
This commit is contained in:
parent
541269f8bc
commit
3a4d994c40
2 changed files with 13 additions and 2 deletions
|
@ -17,7 +17,11 @@ class BootstrapTimelineService < BaseService
|
|||
|
||||
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
|
||||
|
||||
|
@ -40,7 +44,9 @@ class BootstrapTimelineService < BaseService
|
|||
|
||||
def local_unlocked_accounts(usernames)
|
||||
Account.local
|
||||
.without_suspended
|
||||
.where(username: usernames)
|
||||
.where(locked: false)
|
||||
.where(moved_to_account_id: nil)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue