Add width and height in notify custom_emoji
This commit is contained in:
parent
a4e8dcc3c4
commit
6751f0ded8
1 changed files with 18 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue