Add custom emoji size recording and publish api

This commit is contained in:
KMY 2023-03-08 16:32:38 +09:00
parent 47bedd20ca
commit 92df4674ff
6 changed files with 36 additions and 2 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