about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
Diffstat (limited to 'app/services')
-rw-r--r--app/services/activitypub/process_account_service.rb4
-rw-r--r--app/services/fetch_link_card_service.rb2
-rw-r--r--app/services/resolve_account_service.rb2
-rw-r--r--app/services/update_remote_profile_service.rb12
4 files changed, 13 insertions, 7 deletions
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb
index 721c9c928..453253db4 100644
--- a/app/services/activitypub/process_account_service.rb
+++ b/app/services/activitypub/process_account_service.rb
@@ -23,6 +23,8 @@ class ActivityPub::ProcessAccountService < BaseService
         create_account if @account.nil?
         update_account
         process_tags
+      else
+        raise Mastodon::RaceConditionError
       end
     end
 
@@ -44,7 +46,6 @@ class ActivityPub::ProcessAccountService < BaseService
     @account.protocol    = :activitypub
     @account.username    = @username
     @account.domain      = @domain
-    @account.uri         = @uri
     @account.suspended   = true if auto_suspend?
     @account.silenced    = true if auto_silence?
     @account.private_key = nil
@@ -67,6 +68,7 @@ class ActivityPub::ProcessAccountService < BaseService
     @account.followers_url           = @json['followers'] || ''
     @account.featured_collection_url = @json['featured'] || ''
     @account.url                     = url || @uri
+    @account.uri                     = @uri
     @account.display_name            = @json['name'] || ''
     @account.note                    = @json['summary'] || ''
     @account.locked                  = @json['manuallyApprovesFollowers'] || false
diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb
index f9b1b2f0c..86d0f9971 100644
--- a/app/services/fetch_link_card_service.rb
+++ b/app/services/fetch_link_card_service.rb
@@ -23,6 +23,8 @@ class FetchLinkCardService < BaseService
       if lock.acquired?
         @card = PreviewCard.find_by(url: @url)
         process_url if @card.nil? || @card.updated_at <= 2.weeks.ago
+      else
+        raise Mastodon::RaceConditionError
       end
     end
 
diff --git a/app/services/resolve_account_service.rb b/app/services/resolve_account_service.rb
index de8d1151d..4323e7f06 100644
--- a/app/services/resolve_account_service.rb
+++ b/app/services/resolve_account_service.rb
@@ -49,6 +49,8 @@ class ResolveAccountService < BaseService
         else
           handle_ostatus
         end
+      else
+        raise Mastodon::RaceConditionError
       end
     end
 
diff --git a/app/services/update_remote_profile_service.rb b/app/services/update_remote_profile_service.rb
index aca1185de..68d36addf 100644
--- a/app/services/update_remote_profile_service.rb
+++ b/app/services/update_remote_profile_service.rb
@@ -41,24 +41,24 @@ class UpdateRemoteProfileService < BaseService
         account.header.destroy
       end
 
-      save_emojis(account) if remote_profile.emojis.present?
+      save_emojis if remote_profile.emojis.present?
     end
   end
 
-  def save_emojis(parent)
-    do_not_download = DomainBlock.find_by(domain: parent.account.domain)&.reject_media?
+  def save_emojis
+    do_not_download = DomainBlock.find_by(domain: account.domain)&.reject_media?
 
     return if do_not_download
 
-    remote_account.emojis.each do |link|
+    remote_profile.emojis.each do |link|
       next unless link['href'] && link['name']
 
       shortcode = link['name'].delete(':')
-      emoji     = CustomEmoji.find_by(shortcode: shortcode, domain: parent.account.domain)
+      emoji     = CustomEmoji.find_by(shortcode: shortcode, domain: account.domain)
 
       next unless emoji.nil?
 
-      emoji = CustomEmoji.new(shortcode: shortcode, domain: parent.account.domain)
+      emoji = CustomEmoji.new(shortcode: shortcode, domain: account.domain)
       emoji.image_remote_url = link['href']
       emoji.save
     end