Make name of like content parser function more general

This commit is contained in:
Essem 2024-01-13 18:18:36 -06:00
parent 09b64d761a
commit 11bebd28a2
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C

View file

@ -5,7 +5,7 @@ class ActivityPub::Activity::Like < ActivityPub::Activity
original_status = status_from_uri(object_uri) original_status = status_from_uri(object_uri)
return if original_status.nil? || !original_status.account.local? || delete_arrived_first?(@json['id']) return if original_status.nil? || !original_status.account.local? || delete_arrived_first?(@json['id'])
return if maybe_process_misskey_reaction return if maybe_process_embedded_reaction
return if @account.favourited?(original_status) return if @account.favourited?(original_status)
@ -15,10 +15,10 @@ class ActivityPub::Activity::Like < ActivityPub::Activity
Trends.statuses.register(original_status) Trends.statuses.register(original_status)
end end
# Misskey delivers reactions as likes with the emoji in _misskey_reaction and content # Some servers deliver reactions as likes with the emoji in content
# Versions of Misskey before 12.1.0 only specify emojis in _misskey_reaction, so we check both # Versions of Misskey before 12.1.0 specify emojis in _misskey_reaction instead, so we check both
# See https://misskey-hub.net/ns.html#misskey-reaction for details # See https://misskey-hub.net/ns.html#misskey-reaction for details
def maybe_process_misskey_reaction def maybe_process_embedded_reaction
original_status = status_from_uri(object_uri) original_status = status_from_uri(object_uri)
name = @json['content'] || @json['_misskey_reaction'] name = @json['content'] || @json['_misskey_reaction']
return false if name.nil? return false if name.nil?