diff options
author | lain <lain@soykaf.club> | 2020-06-08 11:07:01 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-06-08 11:07:01 +0000 |
commit | d1924926585a477682b8fcc3176521dacb0766dd (patch) | |
tree | 444721bc23aab3c06cf75ffedd05a5bcdb61774a /lib/pleroma/web/admin_api/controllers/admin_api_controller.ex | |
parent | c450b248cc867172d07d7d6e2c3ac072b236732b (diff) | |
parent | b57e4ad1abd6fa0c0597b4343528e211c84b50c1 (diff) | |
download | pleroma-d1924926585a477682b8fcc3176521dacb0766dd.tar.gz |
Merge branch 'openapi/admin/relay' into 'develop'
Add OpenAPI spec for AdminAPI.RelayController
See merge request pleroma/pleroma!2579
Diffstat (limited to 'lib/pleroma/web/admin_api/controllers/admin_api_controller.ex')
-rw-r--r-- | lib/pleroma/web/admin_api/controllers/admin_api_controller.ex | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex index edd3abc63..5cbf0dd4f 100644 --- a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex @@ -16,7 +16,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.Builder alias Pleroma.Web.ActivityPub.Pipeline - alias Pleroma.Web.ActivityPub.Relay alias Pleroma.Web.AdminAPI alias Pleroma.Web.AdminAPI.AccountView alias Pleroma.Web.AdminAPI.ModerationLogView @@ -59,7 +58,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do plug( OAuthScopesPlug, %{scopes: ["write:follows"], admin: true} - when action in [:user_follow, :user_unfollow, :relay_follow, :relay_unfollow] + when action in [:user_follow, :user_unfollow] ) plug( @@ -74,7 +73,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do when action in [ :list_log, :stats, - :relay_list, :need_reboot ] ) @@ -491,50 +489,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do render_error(conn, :forbidden, "You can't revoke your own admin status.") end - def relay_list(conn, _params) do - with {:ok, list} <- Relay.list() do - json(conn, %{relays: list}) - else - _ -> - conn - |> put_status(500) - end - end - - def relay_follow(%{assigns: %{user: admin}} = conn, %{"relay_url" => target}) do - with {:ok, _message} <- Relay.follow(target) do - ModerationLog.insert_log(%{ - action: "relay_follow", - actor: admin, - target: target - }) - - json(conn, target) - else - _ -> - conn - |> put_status(500) - |> json(target) - end - end - - def relay_unfollow(%{assigns: %{user: admin}} = conn, %{"relay_url" => target}) do - with {:ok, _message} <- Relay.unfollow(target) do - ModerationLog.insert_log(%{ - action: "relay_unfollow", - actor: admin, - target: target - }) - - json(conn, target) - else - _ -> - conn - |> put_status(500) - |> json(target) - end - end - @doc "Get a password reset token (base64 string) for given nickname" def get_password_reset(conn, %{"nickname" => nickname}) do (%User{local: true} = user) = User.get_cached_by_nickname(nickname) |