Merge branch 'support/test' into 'develop'
[akkoma] / lib / pleroma / plugs / user_is_admin_plug.ex
index cf22ce5d064602926db32e0820ea636f250472bb..4c4b3d610c15ec69e07cd7d2ea63b46d1bc4df68 100644 (file)
@@ -1,4 +1,9 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
 defmodule Pleroma.Plugs.UserIsAdminPlug do
+  import Pleroma.Web.TranslationHelpers
   import Plug.Conn
   alias Pleroma.User
 
@@ -12,8 +17,7 @@ defmodule Pleroma.Plugs.UserIsAdminPlug do
 
   def call(conn, _) do
     conn
-    |> put_resp_content_type("application/json")
-    |> send_resp(403, Jason.encode!(%{error: "User is not admin."}))
+    |> render_error(:forbidden, "User is not admin.")
     |> halt
   end
 end