Merge branch 'kb_development' into kb_migration

This commit is contained in:
KMY 2023-03-08 16:38:48 +09:00
commit 9e2390f3c9
57 changed files with 227 additions and 64 deletions

View file

@ -3,7 +3,7 @@
class REST::CustomEmojiSerializer < ActiveModel::Serializer
include RoutingHelper
attributes :shortcode, :url, :static_url, :visible_in_picker
attributes :shortcode, :url, :static_url, :visible_in_picker, :width, :height
attribute :category, if: :category_loaded?
@ -22,4 +22,12 @@ class REST::CustomEmojiSerializer < ActiveModel::Serializer
def category_loaded?
object.association(:category).loaded? && object.category.present?
end
def width
object.image_width
end
def height
object.image_height
end
end

View file

@ -9,6 +9,8 @@ class REST::EmojiReactionsGroupedByNameSerializer < ActiveModel::Serializer
attribute :url, if: :custom_emoji?
attribute :static_url, if: :custom_emoji?
attribute :domain, if: :custom_emoji?
attribute :width, if: :custom_emoji?
attribute :height, if: :custom_emoji?
attribute :account_ids, if: :account_ids?
def current_user?
@ -34,4 +36,12 @@ class REST::EmojiReactionsGroupedByNameSerializer < ActiveModel::Serializer
def domain
object.custom_emoji.domain
end
def width
object.custom_emoji.image_width
end
def height
object.custom_emoji.image_height
end
end

View file

@ -77,6 +77,11 @@ class REST::InstanceSerializer < ActiveModel::Serializer
translation: {
enabled: TranslationService.configured?,
},
emoji_reactions: {
max_reactions: EmojiReaction::EMOJI_REACTION_LIMIT,
max_reactions_per_account: EmojiReaction::EMOJI_REACTION_PER_ACCOUNT_LIMIT,
},
}
end
@ -92,6 +97,9 @@ class REST::InstanceSerializer < ActiveModel::Serializer
def fedibird_capabilities
capabilities = [
:emoji_reaction,
:visibility_public_unlisted,
:enable_wide_emoji,
:enable_wide_emoji_reaction,
]
capabilities << :profile_search unless Chewy.enabled?

View file

@ -141,7 +141,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
current_user? &&
current_user.account_id == object.account_id &&
!object.reblog? &&
%w(public unlisted private).include?(object.visibility)
%w(public unlisted public_unlisted private).include?(object.visibility)
end
def source_requested?

View file

@ -83,6 +83,11 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
min_expiration: PollValidator::MIN_EXPIRATION,
max_expiration: PollValidator::MAX_EXPIRATION,
},
emoji_reactions: {
max_reactions: EmojiReaction::EMOJI_REACTION_LIMIT,
max_reactions_per_account: EmojiReaction::EMOJI_REACTION_PER_ACCOUNT_LIMIT,
},
}
end
@ -102,6 +107,9 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
def fedibird_capabilities
capabilities = [
:emoji_reaction,
:visibility_public_unlisted,
:enable_wide_emoji,
:enable_wide_emoji_reaction,
]
capabilities << :profile_search unless Chewy.enabled?