Merge commit 'fac734b6a8' into kb_migration

This commit is contained in:
KMY 2023-04-13 18:57:03 +09:00
commit 5a661415e2
22 changed files with 121 additions and 14 deletions

View file

@ -97,10 +97,12 @@ class REST::InstanceSerializer < ActiveModel::Serializer
def fedibird_capabilities
capabilities = [
:emoji_reaction,
:visibility_public_unlisted,
:kmyblue_extra_media_attachments,
:kmyblue_visibility_public_unlisted,
:enable_wide_emoji,
:enable_wide_emoji_reaction,
:searchability,
:kmyblue_searchability,
:kmyblue_markdown,
]
capabilities << :profile_search unless Chewy.enabled?

View file

@ -9,6 +9,8 @@ class REST::NotifyEmojiReactionSerializer < ActiveModel::Serializer
attribute :url, if: :custom_emoji?
attribute :static_url, if: :custom_emoji?
attribute :domain, if: :custom_emoji?
attribute :width, if: :width?
attribute :height, if: :height?
def count?
object.respond_to?(:count)
@ -33,4 +35,20 @@ class REST::NotifyEmojiReactionSerializer < ActiveModel::Serializer
def domain
object.custom_emoji.domain
end
def width?
custom_emoji? && (object.custom_emoji.respond_to?(:image_width) || object.custom_emoji.respond_to?(:width))
end
def height?
custom_emoji? && (object.custom_emoji.respond_to?(:image_height) || object.custom_emoji.respond_to?(:height))
end
def width
object.custom_emoji.respond_to?(:image_width) ? object.custom_emoji.image_width : object.custom_emoji.width
end
def height
object.custom_emoji.respond_to?(:image_height) ? object.custom_emoji.image_height : object.custom_emoji.height
end
end

View file

@ -5,7 +5,7 @@ class REST::StatusEditSerializer < ActiveModel::Serializer
has_one :account, serializer: REST::AccountSerializer
attributes :content, :spoiler_text, :sensitive, :created_at
attributes :content, :spoiler_text, :markdown, :sensitive, :created_at
has_many :ordered_media_attachments, key: :media_attachments, serializer: REST::MediaAttachmentSerializer
has_many :emojis, serializer: REST::CustomEmojiSerializer

View file

@ -5,8 +5,8 @@ class REST::StatusSerializer < ActiveModel::Serializer
attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id,
:sensitive, :spoiler_text, :visibility, :visibility_ex, :language,
:uri, :url, :replies_count, :reblogs_count, :searchability,
:favourites_count, :emoji_reactions, :edited_at
:uri, :url, :replies_count, :reblogs_count, :searchability, :markdown,
:favourites_count, :emoji_reactions, :emoji_reactions_count, :edited_at
attribute :favourited, if: :current_user?
attribute :reblogged, if: :current_user?

View file

@ -107,9 +107,12 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
def fedibird_capabilities
capabilities = [
:emoji_reaction,
:visibility_public_unlisted,
:kmyblue_extra_media_attachments,
:kmyblue_visibility_public_unlisted,
:enable_wide_emoji,
:enable_wide_emoji_reaction,
:kmyblue_searchability,
:kmyblue_markdown,
]
capabilities << :profile_search unless Chewy.enabled?