about summary refs log tree commit diff
path: root/app/serializers/rest
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-09-23 01:57:23 +0200
committerGitHub <noreply@github.com>2017-09-23 01:57:23 +0200
commit293972f716476933df2b665ad755cafe4d29d82d (patch)
tree6719153a554c918800d8eb3f1624d9e0d666318c /app/serializers/rest
parent9c8e602163811fc9a21c5ae78d53d46d7dbc8db7 (diff)
New API: GET /api/v1/custom_emojis to get a server's custom emojis (#5051)
Diffstat (limited to 'app/serializers/rest')
-rw-r--r--app/serializers/rest/custom_emoji_serializer.rb11
-rw-r--r--app/serializers/rest/status_serializer.rb12
2 files changed, 12 insertions, 11 deletions
diff --git a/app/serializers/rest/custom_emoji_serializer.rb b/app/serializers/rest/custom_emoji_serializer.rb
new file mode 100644
index 000000000..b744dd4ec
--- /dev/null
+++ b/app/serializers/rest/custom_emoji_serializer.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class REST::CustomEmojiSerializer < ActiveModel::Serializer
+  include RoutingHelper
+
+  attributes :shortcode, :url
+
+  def url
+    full_asset_url(object.image.url)
+  end
+end
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb
index e0fd1c77e..ef3c325ba 100644
--- a/app/serializers/rest/status_serializer.rb
+++ b/app/serializers/rest/status_serializer.rb
@@ -17,7 +17,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
   has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
   has_many :mentions
   has_many :tags
-  has_many :emojis
+  has_many :emojis, serializer: REST::CustomEmojiSerializer
 
   def id
     object.id.to_s
@@ -119,14 +119,4 @@ class REST::StatusSerializer < ActiveModel::Serializer
       tag_url(object)
     end
   end
-
-  class CustomEmojiSerializer < ActiveModel::Serializer
-    include RoutingHelper
-
-    attributes :shortcode, :url
-
-    def url
-      full_asset_url(object.image.url)
-    end
-  end
 end