Fix refollowing (#4931)
* Make RefollowWorker ActivityPub-only to avoid potential identifier mismatches * Don't call RefollowWorker on new accountsremotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
parent
9239e4ce4d
commit
af00220d79
|
@ -15,11 +15,11 @@ class ActivityPub::ProcessAccountService < BaseService
|
||||||
@account = Account.find_by(uri: @uri)
|
@account = Account.find_by(uri: @uri)
|
||||||
@collections = {}
|
@collections = {}
|
||||||
|
|
||||||
|
old_public_key = @account&.public_key
|
||||||
create_account if @account.nil?
|
create_account if @account.nil?
|
||||||
upgrade_account if @account.ostatus?
|
upgrade_account if @account.ostatus?
|
||||||
old_public_key = @account.public_key
|
|
||||||
update_account
|
update_account
|
||||||
RefollowWorker.perform_async(@account.id) if old_public_key != @account.public_key
|
RefollowWorker.perform_async(@account.id) if !old_public_key.nil? && old_public_key != @account.public_key
|
||||||
|
|
||||||
@account
|
@account
|
||||||
rescue Oj::ParseError
|
rescue Oj::ParseError
|
||||||
|
|
|
@ -85,10 +85,8 @@ class ResolveRemoteAccountService < BaseService
|
||||||
|
|
||||||
def handle_ostatus
|
def handle_ostatus
|
||||||
create_account if @account.nil?
|
create_account if @account.nil?
|
||||||
old_public_key = @account.public_key
|
|
||||||
update_account
|
update_account
|
||||||
update_account_profile if update_profile?
|
update_account_profile if update_profile?
|
||||||
RefollowWorker.perform_async(@account.id) if old_public_key != @account.public_key
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_profile?
|
def update_profile?
|
||||||
|
|
|
@ -7,6 +7,7 @@ class RefollowWorker
|
||||||
|
|
||||||
def perform(target_account_id)
|
def perform(target_account_id)
|
||||||
target_account = Account.find(target_account_id)
|
target_account = Account.find(target_account_id)
|
||||||
|
return unless target_account.protocol == :activitypub
|
||||||
|
|
||||||
target_account.followers.where(domain: nil).find_each do |follower|
|
target_account.followers.where(domain: nil).find_each do |follower|
|
||||||
# Locally unfollow remote account
|
# Locally unfollow remote account
|
||||||
|
|
Loading…
Reference in New Issue