From ccd6b1956d11a2a7a738dd87770ac109114d4366 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 10 Nov 2018 14:55:49 +0100 Subject: [PATCH] lib/pleroma/web/admin_api/admin_api_controller.ex: Support status reply of Relay.{un,}follow --- lib/pleroma/web/admin_api/admin_api_controller.ex | 26 +++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/pleroma/web/admin_api/admin_api_controller.ex b/lib/pleroma/web/admin_api/admin_api_controller.ex index c1df2d570..360ce0732 100644 --- a/lib/pleroma/web/admin_api/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/admin_api_controller.ex @@ -78,7 +78,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do when right in ["moderator", "admin"] do if admin_nickname == nickname do conn - |> post_status(403) + |> put_status(403) |> json(%{error: "You can't revoke your own admin status."}) else user = User.get_by_nickname(nickname) @@ -102,17 +102,29 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do end def relay_follow(conn, %{"relay_url" => target}) do - :ok = Relay.follow(target) + status = Relay.follow(target) - conn - |> json(target) + if status == :ok do + conn + |> json(target) + else + conn + |> put_status(500) + |> json(target) + end end def relay_unfollow(conn, %{"relay_url" => target}) do - :ok = Relay.unfollow(target) + status = Relay.unfollow(target) - conn - |> json(target) + if status == :ok do + conn + |> json(target) + else + conn + |> put_status(500) + |> json(target) + end end @shortdoc "Get a account registeration invite token (base64 string)"