Fix emoji reactions compativility for Pleroma and akkoma

This commit is contained in:
noellabo 2022-06-16 08:20:00 +09:00
parent d0b97a2fcb
commit 1b9f659e97

View file

@ -4,14 +4,14 @@ class ActivityPub::EmojiReactionSerializer < ActivityPub::Serializer
attributes :id, :type, :actor, :content
attribute :virtual_object, key: :object
has_one :custom_emoji ,key: :tag, serializer: ActivityPub::EmojiSerializer, unless: -> { object.custom_emoji.nil? }
has_many :virtual_tags, key: :tag, unless: -> { object.custom_emoji.nil? }
def id
ActivityPub::TagManager.instance.uri_for(object)
end
def type
'Like'
object.custom_emoji.nil? ? 'EmojiReact' : 'Like'
end
def actor
@ -25,4 +25,10 @@ class ActivityPub::EmojiReactionSerializer < ActivityPub::Serializer
def content
object.custom_emoji.nil? ? object.name : ":#{object.name}:"
end
def virtual_tags
[object.custom_emoji]
end
class CustomEmojiSerializer < ActivityPub::EmojiSerializer
end
end