about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2017-06-15 11:04:23 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-06-15 11:04:23 +0200
commit51b2f789bd1d6d4e00f02f5476ff7e6af25fce49 (patch)
tree27003842b7b89185038d986ec77610d9498d8667
parent947887f261f74f84312327a5265553e8f16655fe (diff)
Fix #3633 by not spawning RemoteProfileUpdateWorker from FetchRemoteAccountService (#3642)
-rw-r--r--app/services/concerns/author_extractor.rb4
-rw-r--r--app/services/fetch_remote_account_service.rb2
-rw-r--r--app/services/follow_remote_account_service.rb6
3 files changed, 6 insertions, 6 deletions
diff --git a/app/services/concerns/author_extractor.rb b/app/services/concerns/author_extractor.rb
index 71bd32f37..ae32eebbb 100644
--- a/app/services/concerns/author_extractor.rb
+++ b/app/services/concerns/author_extractor.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 module AuthorExtractor
-  def author_from_xml(xml)
+  def author_from_xml(xml, update_profile = true)
     return nil if xml.nil?
 
     # Try <email> for acct
@@ -18,6 +18,6 @@ module AuthorExtractor
       acct   = "#{username}@#{domain}"
     end
 
-    FollowRemoteAccountService.new.call(acct)
+    FollowRemoteAccountService.new.call(acct, update_profile)
   end
 end
diff --git a/app/services/fetch_remote_account_service.rb b/app/services/fetch_remote_account_service.rb
index 98fdf3dfe..8eed0d454 100644
--- a/app/services/fetch_remote_account_service.rb
+++ b/app/services/fetch_remote_account_service.rb
@@ -21,7 +21,7 @@ class FetchRemoteAccountService < BaseService
     xml = Nokogiri::XML(body)
     xml.encoding = 'utf-8'
 
-    account = author_from_xml(xml.at_xpath('/xmlns:feed', xmlns: TagManager::XMLNS))
+    account = author_from_xml(xml.at_xpath('/xmlns:feed', xmlns: TagManager::XMLNS), false)
 
     UpdateRemoteProfileService.new.call(xml, account) unless account.nil?
 
diff --git a/app/services/follow_remote_account_service.rb b/app/services/follow_remote_account_service.rb
index 8558e6d02..30ba7bc75 100644
--- a/app/services/follow_remote_account_service.rb
+++ b/app/services/follow_remote_account_service.rb
@@ -11,7 +11,7 @@ class FollowRemoteAccountService < BaseService
   # important information from their feed
   # @param [String] uri User URI in the form of username@domain
   # @return [Account]
-  def call(uri, redirected = nil)
+  def call(uri, update_profile = true, redirected = nil)
     username, domain = uri.split('@')
 
     return Account.find_local(username) if TagManager.instance.local_domain?(domain)
@@ -29,7 +29,7 @@ class FollowRemoteAccountService < BaseService
     confirmed_username, confirmed_domain = data.subject.gsub(/\Aacct:/, '').split('@')
 
     unless confirmed_username.casecmp(username).zero? && confirmed_domain.casecmp(domain).zero?
-      return call("#{confirmed_username}@#{confirmed_domain}", true) if redirected.nil?
+      return call("#{confirmed_username}@#{confirmed_domain}", update_profile, true) if redirected.nil?
       raise Goldfinger::Error, 'Requested and returned acct URI do not match'
     end
 
@@ -63,7 +63,7 @@ class FollowRemoteAccountService < BaseService
 
     begin
       account.save!
-      get_profile(body, account)
+      get_profile(body, account) if update_profile
     rescue ActiveRecord::RecordNotUnique
       # The account has been added by another worker!
       return Account.find_remote(confirmed_username, confirmed_domain)