* Wip: スタンプを他サーバーから受信するテスト作成、カスタム絵文字にdomainプロパティを追加 * Wip: ドメインに関するイレギュラーな状況に対応 * Wip: 他のサーバーのカスタム絵文字を送信するときのID変更処理を追加 * Wip: カスタム絵文字のIDを判定する場所を変更 * Wip: カスタム絵文字のURIを返す処理を削除(不要) * Wip: 絵文字リアクション受け入れ処理リファクタリング * Wip: 外部へ送信するカスタム絵文字データにライセンス情報を追加、ライセンス情報の受信をテストに追加 * Wip: ドメインブロックのテストを追加 * Wip: ついでに通常のドメインブロックを追加
37 lines
648 B
Ruby
37 lines
648 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ActivityPub::EmojiSerializer < ActivityPub::Serializer
|
|
include RoutingHelper
|
|
|
|
context_extensions :emoji
|
|
|
|
attributes :id, :type, :domain, :name, :is_sensitive, :updated
|
|
|
|
attribute :license, if: -> { object.license.present? }
|
|
|
|
has_one :icon, serializer: ActivityPub::ImageSerializer
|
|
|
|
def id
|
|
ActivityPub::TagManager.instance.uri_for(object)
|
|
end
|
|
|
|
def type
|
|
'Emoji'
|
|
end
|
|
|
|
def domain
|
|
object.domain.presence || Rails.configuration.x.local_domain
|
|
end
|
|
|
|
def icon
|
|
object.image
|
|
end
|
|
|
|
def updated
|
|
object.updated_at.iso8601
|
|
end
|
|
|
|
def name
|
|
":#{object.shortcode}:"
|
|
end
|
|
end
|