]>
cat aescling's git repositories - mastodon.git/blob - app/workers/move_worker.rb
1 # frozen_string_literal: true
4 include Sidekiq
::Worker
6 def perform(source_account_id
, target_account_id
)
7 @source_account = Account
.find(source_account_id
)
8 @target_account = Account
.find(target_account_id
)
10 if @target_account.local
?
13 queue_follow_unfollows!
15 rescue ActiveRecord
::RecordNotFound
22 @source_account.passive_relationships
23 .where(account
: Account
.local
)
25 .update_all(target_account
: @target_account)
28 def queue_follow_unfollows!
29 @source_account.followers
.local
.select(:id).find_in_batches
do |accounts
|
30 UnfollowFollowWorker
.push_bulk(accounts
.map(&:id)) { |follower_id
| [follower_id
, @source_account.id
, @target_account.id
] }
This page took 0.08045 seconds and 5 git commands to generate.