parent
072158ee97
commit
e64e6a03dd
13 changed files with 86 additions and 18 deletions
|
@ -5,6 +5,8 @@ class REST::CustomEmojiSerializer < ActiveModel::Serializer
|
|||
|
||||
attributes :shortcode, :url, :static_url, :visible_in_picker
|
||||
|
||||
attribute :category, if: :category_loaded?
|
||||
|
||||
def url
|
||||
full_asset_url(object.image.url)
|
||||
end
|
||||
|
@ -12,4 +14,12 @@ class REST::CustomEmojiSerializer < ActiveModel::Serializer
|
|||
def static_url
|
||||
full_asset_url(object.image.url(:static))
|
||||
end
|
||||
|
||||
def category
|
||||
object.category.name
|
||||
end
|
||||
|
||||
def category_loaded?
|
||||
object.association(:category).loaded? && object.category.present?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue