* Wip: スタンプを他サーバーから受信するテスト作成、カスタム絵文字にdomainプロパティを追加 * Wip: ドメインに関するイレギュラーな状況に対応 * Wip: 他のサーバーのカスタム絵文字を送信するときのID変更処理を追加 * Wip: カスタム絵文字のIDを判定する場所を変更 * Wip: カスタム絵文字のURIを返す処理を削除(不要) * Wip: 絵文字リアクション受け入れ処理リファクタリング * Wip: 外部へ送信するカスタム絵文字データにライセンス情報を追加、ライセンス情報の受信をテストに追加 * Wip: ドメインブロックのテストを追加 * Wip: ついでに通常のドメインブロックを追加
35 lines
557 B
Ruby
35 lines
557 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ActivityPub::Parser::CustomEmojiParser
|
|
include JsonLdHelper
|
|
|
|
def initialize(json)
|
|
@json = json
|
|
end
|
|
|
|
def uri
|
|
@json['id']
|
|
end
|
|
|
|
def shortcode
|
|
@json['name']&.delete(':')
|
|
end
|
|
|
|
def image_remote_url
|
|
@json.dig('icon', 'url')
|
|
end
|
|
|
|
def updated_at
|
|
@json['updated']&.to_datetime
|
|
rescue ArgumentError
|
|
nil
|
|
end
|
|
|
|
def is_sensitive # rubocop:disable Naming/PredicateName
|
|
(@json['isSensitive'].presence || false)
|
|
end
|
|
|
|
def license
|
|
@json['license'] || @json['licence']
|
|
end
|
|
end
|