Fix: #172 他のサーバーからの相乗り絵文字削除が反映されない

This commit is contained in:
KMY 2023-10-23 09:11:45 +09:00 committed by KMY(雪あすか)
parent 1de49649fa
commit 7c5b99df61
3 changed files with 96 additions and 4 deletions

View file

@ -121,7 +121,12 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
if shortcode.present?
emoji_tag = @object['tag'].is_a?(Array) ? @object['tag']&.first : @object['tag']
emoji = CustomEmoji.find_by(shortcode: shortcode, domain: @account.domain) if emoji_tag.present? && emoji_tag['id'].present?
emoji = nil
if emoji_tag.present? && emoji_tag['id'].present?
domain = URI.split(emoji_tag['id'])[2]
domain = nil if domain == Rails.configuration.x.local_domain || domain == Rails.configuration.x.web_domain
emoji = CustomEmoji.find_by(shortcode: shortcode, domain: domain) if emoji_tag.present? && emoji_tag['id'].present?
end
emoji_reaction = @original_status.emoji_reactions.where(account: @account, name: shortcode, custom_emoji: emoji).first

View file

@ -247,8 +247,16 @@ module AccountInteractions
status.proper.favourites.where(account: self).exists?
end
def emoji_reactioned?(status)
status.proper.emoji_reactions.where(account: self).exists?
def emoji_reacted?(status, shortcode = nil, domain = nil, domain_force = false) # rubocop:disable Style/OptionalBooleanParameter
if shortcode.present?
if domain.present? || domain_force
status.proper.emoji_reactions.joins(:custom_emoji).where(account: self, name: shortcode, custom_emoji: { domain: domain }).exists?
else
status.proper.emoji_reactions.where(account: self, name: shortcode).exists?
end
else
status.proper.emoji_reactions.where(account: self).exists?
end
end
def bookmarked?(status)