]> cat aescling's git repositories - mastodon.git/commitdiff
Fix custom emoji handling in UpdateRemoteProfileService (OStatus) (#7501)
authorunarist <m.unarist@gmail.com>
Tue, 15 May 2018 14:03:34 +0000 (23:03 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 15 May 2018 14:03:34 +0000 (16:03 +0200)
This patch fixes NoMethodError and others in RemoteProfileUpdateWorker.

app/services/update_remote_profile_service.rb

index aca1185de2c9de1885308780014504ef9e985b5d..68d36addfcaf12442568d3f8210768cb72c1e336 100644 (file)
@@ -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