lib/pleroma/web/admin_api/admin_api_controller.ex: Support status reply of Relay.{un,}follow
This commit is contained in:
parent
7fbfd2db96
commit
ccd6b1956d
@ -78,7 +78,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
|||||||
when right in ["moderator", "admin"] do
|
when right in ["moderator", "admin"] do
|
||||||
if admin_nickname == nickname do
|
if admin_nickname == nickname do
|
||||||
conn
|
conn
|
||||||
|> post_status(403)
|
|> put_status(403)
|
||||||
|> json(%{error: "You can't revoke your own admin status."})
|
|> json(%{error: "You can't revoke your own admin status."})
|
||||||
else
|
else
|
||||||
user = User.get_by_nickname(nickname)
|
user = User.get_by_nickname(nickname)
|
||||||
@ -102,17 +102,29 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def relay_follow(conn, %{"relay_url" => target}) do
|
def relay_follow(conn, %{"relay_url" => target}) do
|
||||||
:ok = Relay.follow(target)
|
status = Relay.follow(target)
|
||||||
|
|
||||||
|
if status == :ok do
|
||||||
conn
|
conn
|
||||||
|> json(target)
|
|> json(target)
|
||||||
|
else
|
||||||
|
conn
|
||||||
|
|> put_status(500)
|
||||||
|
|> json(target)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def relay_unfollow(conn, %{"relay_url" => target}) do
|
def relay_unfollow(conn, %{"relay_url" => target}) do
|
||||||
:ok = Relay.unfollow(target)
|
status = Relay.unfollow(target)
|
||||||
|
|
||||||
|
if status == :ok do
|
||||||
conn
|
conn
|
||||||
|> json(target)
|
|> json(target)
|
||||||
|
else
|
||||||
|
conn
|
||||||
|
|> put_status(500)
|
||||||
|
|> json(target)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@shortdoc "Get a account registeration invite token (base64 string)"
|
@shortdoc "Get a account registeration invite token (base64 string)"
|
||||||
|
Loading…
Reference in New Issue
Block a user