Browse Source

Do not crash if remote custom emoji does not define updated date (fixes #8376) (#8377)

master
ThibG 6 years ago
committed by Eugen Rochko
parent
commit
42573b76f1
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      app/lib/activitypub/activity/create.rb
  2. +1
    -1
      app/services/activitypub/process_account_service.rb

+ 1
- 1
app/lib/activitypub/activity/create.rb View 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

+ 1
- 1
app/services/activitypub/process_account_service.rb View 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

Loading…
Cancel
Save