parent
76edf82499
commit
5497e2ae5d
6 changed files with 15 additions and 2 deletions
|
@ -30,6 +30,8 @@ module ContextHelper
|
|||
other_setting: { 'fedibird' => 'http://fedibird.com/ns#', 'otherSetting' => 'fedibird:otherSetting' },
|
||||
references: { 'fedibird' => 'http://fedibird.com/ns#', 'references' => { '@id' => 'fedibird:references', '@type' => '@id' } },
|
||||
quote_uri: { 'fedibird' => 'http://fedibird.com/ns#', 'quoteUri' => 'fedibird:quoteUri' },
|
||||
keywords: { 'schema' => 'http://schema.org#', 'keywords' => 'schema:keywords' },
|
||||
license: { 'schema' => 'http://schema.org#', 'license' => 'schema:license' },
|
||||
olm: {
|
||||
'toot' => 'http://joinmastodon.org/ns#', 'Device' => 'toot:Device', 'Ed25519Signature' => 'toot:Ed25519Signature', 'Ed25519Key' => 'toot:Ed25519Key', 'Curve25519Key' => 'toot:Curve25519Key', 'EncryptedMessage' => 'toot:EncryptedMessage', 'publicKeyBase64' => 'toot:publicKeyBase64', 'deviceId' => 'toot:deviceId',
|
||||
'claim' => { '@type' => '@id', '@id' => 'toot:claim' },
|
||||
|
|
|
@ -274,6 +274,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
emoji.image_remote_url = custom_emoji_parser.image_remote_url
|
||||
emoji.license = custom_emoji_parser.license
|
||||
emoji.is_sensitive = custom_emoji_parser.is_sensitive
|
||||
emoji.aliases = custom_emoji_parser.aliases
|
||||
emoji.save
|
||||
rescue Seahorse::Client::NetworkingError => e
|
||||
Rails.logger.warn "Error storing emoji: #{e}"
|
||||
|
|
|
@ -127,6 +127,7 @@ class ActivityPub::Activity::Like < ActivityPub::Activity
|
|||
emoji.image_remote_url = custom_emoji_parser.image_remote_url
|
||||
emoji.license = custom_emoji_parser.license
|
||||
emoji.is_sensitive = custom_emoji_parser.is_sensitive
|
||||
emoji.aliases = custom_emoji_parser.aliases
|
||||
emoji.save
|
||||
rescue Seahorse::Client::NetworkingError => e
|
||||
Rails.logger.warn "Error storing emoji: #{e}"
|
||||
|
|
|
@ -15,6 +15,10 @@ class ActivityPub::Parser::CustomEmojiParser
|
|||
@json['name']&.delete(':')
|
||||
end
|
||||
|
||||
def aliases
|
||||
as_array(@json['keywords'])
|
||||
end
|
||||
|
||||
def image_remote_url
|
||||
@json.dig('icon', 'url')
|
||||
end
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
class ActivityPub::EmojiSerializer < ActivityPub::Serializer
|
||||
include RoutingHelper
|
||||
|
||||
context_extensions :emoji
|
||||
context_extensions :emoji, :license, :keywords
|
||||
|
||||
attributes :id, :type, :domain, :name, :is_sensitive, :updated
|
||||
attributes :id, :type, :domain, :name, :keywords, :is_sensitive, :updated
|
||||
|
||||
attribute :license, if: -> { object.license.present? }
|
||||
|
||||
|
@ -23,6 +23,10 @@ class ActivityPub::EmojiSerializer < ActivityPub::Serializer
|
|||
object.domain.presence || Rails.configuration.x.local_domain
|
||||
end
|
||||
|
||||
def keywords
|
||||
object.aliases
|
||||
end
|
||||
|
||||
def icon
|
||||
object.image
|
||||
end
|
||||
|
|
|
@ -249,6 +249,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||
emoji.image_remote_url = custom_emoji_parser.image_remote_url
|
||||
emoji.license = custom_emoji_parser.license
|
||||
emoji.is_sensitive = custom_emoji_parser.is_sensitive
|
||||
emoji.aliases = custom_emoji_parser.aliases
|
||||
emoji.save
|
||||
rescue Seahorse::Client::NetworkingError => e
|
||||
Rails.logger.warn "Error storing emoji: #{e}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue