[#394] Added users.tags and admin routes to tag and untag users. Added tests.
This commit is contained in:
parent
ccf0b46dd6
commit
7b19487389
8 changed files with 139 additions and 2 deletions
|
|
@ -3,6 +3,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
|||
alias Pleroma.{User, Repo}
|
||||
alias Pleroma.Web.ActivityPub.Relay
|
||||
|
||||
import Pleroma.Web.ControllerHelper, only: [json_response: 3]
|
||||
|
||||
require Logger
|
||||
|
||||
action_fallback(:errors)
|
||||
|
|
@ -40,6 +42,16 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
|||
|> json(new_user.nickname)
|
||||
end
|
||||
|
||||
def tag_users(conn, %{"nicknames" => nicknames, "tags" => tags}) do
|
||||
with {:ok, _} <- User.tag(nicknames, tags),
|
||||
do: json_response(conn, :no_content, "")
|
||||
end
|
||||
|
||||
def untag_users(conn, %{"nicknames" => nicknames, "tags" => tags}) do
|
||||
with {:ok, _} <- User.untag(nicknames, tags),
|
||||
do: json_response(conn, :no_content, "")
|
||||
end
|
||||
|
||||
def right_add(conn, %{"permission_group" => permission_group, "nickname" => nickname})
|
||||
when permission_group in ["moderator", "admin"] do
|
||||
user = User.get_by_nickname(nickname)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue