mirror of https://github.com/mastodon/mastodon.git
Fix custom emoji handling in UpdateRemoteProfileService (OStatus) (#7501)
This patch fixes NoMethodError and others in RemoteProfileUpdateWorker.pull/7359/merge
parent
1f74c1dbcb
commit
d47091eb97
|
@ -41,24 +41,24 @@ class UpdateRemoteProfileService < BaseService
|
||||||
account.header.destroy
|
account.header.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
save_emojis(account) if remote_profile.emojis.present?
|
save_emojis if remote_profile.emojis.present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_emojis(parent)
|
def save_emojis
|
||||||
do_not_download = DomainBlock.find_by(domain: parent.account.domain)&.reject_media?
|
do_not_download = DomainBlock.find_by(domain: account.domain)&.reject_media?
|
||||||
|
|
||||||
return if do_not_download
|
return if do_not_download
|
||||||
|
|
||||||
remote_account.emojis.each do |link|
|
remote_profile.emojis.each do |link|
|
||||||
next unless link['href'] && link['name']
|
next unless link['href'] && link['name']
|
||||||
|
|
||||||
shortcode = link['name'].delete(':')
|
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?
|
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.image_remote_url = link['href']
|
||||||
emoji.save
|
emoji.save
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue