Create AdminAPI.UserView to avoid compile-time dep
authorAlex Gleason <alex@alexgleason.me>
Tue, 8 Jun 2021 20:58:19 +0000 (15:58 -0500)
committerAlex Gleason <alex@alexgleason.me>
Tue, 8 Jun 2021 21:34:06 +0000 (16:34 -0500)
Speeds up recompilation

lib/pleroma/web/admin_api/controllers/user_controller.ex
lib/pleroma/web/admin_api/views/user_view.ex [new file with mode: 0644]

index d3e4c18a35f624dd4c818e643d1021a0e2ecaf03..637a0e702d37003800144b4767d91de8a7a99d22 100644 (file)
@@ -45,8 +45,6 @@ defmodule Pleroma.Web.AdminAPI.UserController do
     when action in [:follow, :unfollow]
   )
 
-  plug(:put_view, Pleroma.Web.AdminAPI.AccountView)
-
   action_fallback(AdminAPI.FallbackController)
 
   defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.Admin.UserOperation
diff --git a/lib/pleroma/web/admin_api/views/user_view.ex b/lib/pleroma/web/admin_api/views/user_view.ex
new file mode 100644 (file)
index 0000000..e91265f
--- /dev/null
@@ -0,0 +1,10 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.AdminAPI.UserView do
+  use Pleroma.Web, :view
+  alias Pleroma.Web.AdminAPI
+
+  def render(view, opts), do: AdminAPI.AccountView.render(view, opts)
+end