]> cat aescling's git repositories - mastodon.git/commitdiff
Do not crash if remote custom emoji does not define updated date (fixes #8376) (...
authorThibG <thib@sitedethib.com>
Wed, 22 Aug 2018 22:27:58 +0000 (00:27 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 22 Aug 2018 22:27:58 +0000 (00:27 +0200)
app/lib/activitypub/activity/create.rb
app/services/activitypub/process_account_service.rb

index 00479fd9a5ddff1b5f8e587c3fee858aa09b34cc..79efc95d31ff85b6274a7c7093b6cec1e1b6ad10 100644 (file)
@@ -107,7 +107,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
     updated   = tag['updated']
     emoji     = CustomEmoji.find_by(shortcode: shortcode, domain: @account.domain)
 
-    return unless emoji.nil? || emoji.updated_at >= updated
+    return unless emoji.nil? || image_url != emoji.image_remote_url || (updated && emoji.updated_at >= updated)
 
     emoji ||= CustomEmoji.new(domain: @account.domain, shortcode: shortcode, uri: uri)
     emoji.image_remote_url = image_url
index 7f95678b031b81f378bac9fc4008903282eef66b..ac19bf933e50ed745811ef180510b56eefd0b315 100644 (file)
@@ -226,7 +226,7 @@ class ActivityPub::ProcessAccountService < BaseService
     updated   = tag['updated']
     emoji     = CustomEmoji.find_by(shortcode: shortcode, domain: @account.domain)
 
-    return unless emoji.nil? || emoji.updated_at >= updated
+    return unless emoji.nil? || image_url != emoji.image_remote_url || (updated && emoji.updated_at >= updated)
 
     emoji ||= CustomEmoji.new(domain: @account.domain, shortcode: shortcode, uri: uri)
     emoji.image_remote_url = image_url