about summary refs log tree commit diff
path: root/app/controllers
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/controllers
parent9c8e602163811fc9a21c5ae78d53d46d7dbc8db7 (diff)
New API: GET /api/v1/custom_emojis to get a server's custom emojis (#5051)
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/custom_emojis_controller.rb2
-rw-r--r--app/controllers/api/v1/custom_emojis_controller.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/admin/custom_emojis_controller.rb b/app/controllers/admin/custom_emojis_controller.rb
index 572ad1ac2..d70514d9a 100644
--- a/app/controllers/admin/custom_emojis_controller.rb
+++ b/app/controllers/admin/custom_emojis_controller.rb
@@ -3,7 +3,7 @@
 module Admin
   class CustomEmojisController < BaseController
     def index
-      @custom_emojis = CustomEmoji.where(domain: nil)
+      @custom_emojis = CustomEmoji.local
     end
 
     def new
diff --git a/app/controllers/api/v1/custom_emojis_controller.rb b/app/controllers/api/v1/custom_emojis_controller.rb
new file mode 100644
index 000000000..4dd77fb55
--- /dev/null
+++ b/app/controllers/api/v1/custom_emojis_controller.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class Api::V1::CustomEmojisController < Api::BaseController
+  respond_to :json
+
+  def index
+    render json: CustomEmoji.local, each_serializer: REST::CustomEmojiSerializer
+  end
+end