Fix: リモートから自分のサーバーの絵文字を使ってスタンプをつけられた時、既存の絵文字が消えてしまう場合がある問題
This commit is contained in:
parent
e7e70b21d2
commit
6cce68fda4
2 changed files with 10 additions and 1 deletions
|
@ -94,7 +94,12 @@ class ActivityPub::Activity::Like < ActivityPub::Activity
|
||||||
return if custom_emoji_parser.shortcode.blank? || custom_emoji_parser.image_remote_url.blank?
|
return if custom_emoji_parser.shortcode.blank? || custom_emoji_parser.image_remote_url.blank?
|
||||||
|
|
||||||
domain = tag['domain'] || URI.split(custom_emoji_parser.uri)[2] || @account.domain
|
domain = tag['domain'] || URI.split(custom_emoji_parser.uri)[2] || @account.domain
|
||||||
domain = nil if domain == Rails.configuration.x.local_domain || domain == Rails.configuration.x.web_domain
|
|
||||||
|
if domain == Rails.configuration.x.local_domain || domain == Rails.configuration.x.web_domain
|
||||||
|
# Block overwriting remote-but-local data
|
||||||
|
return CustomEmoji.find_by(shortcode: custom_emoji_parser.shortcode, domain: nil)
|
||||||
|
end
|
||||||
|
|
||||||
return if domain.present? && skip_download?(domain)
|
return if domain.present? && skip_download?(domain)
|
||||||
|
|
||||||
emoji = CustomEmoji.find_by(shortcode: custom_emoji_parser.shortcode, domain: domain)
|
emoji = CustomEmoji.find_by(shortcode: custom_emoji_parser.shortcode, domain: domain)
|
||||||
|
|
|
@ -185,6 +185,10 @@ RSpec.describe ActivityPub::Activity::Like do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
|
Fabricate(:custom_emoji, domain: nil, shortcode: 'tinking', license: 'Everyone but Ohagi')
|
||||||
|
end
|
||||||
|
|
||||||
it 'create emoji reaction' do
|
it 'create emoji reaction' do
|
||||||
expect(subject.count).to eq 1
|
expect(subject.count).to eq 1
|
||||||
expect(subject.first.name).to eq 'tinking'
|
expect(subject.first.name).to eq 'tinking'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue