+ |> json(AccountView.render("show.json", %{user: updated_user}))
+ 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 list_users(%{assigns: %{user: admin}} = conn, params) do
+ {page, page_size} = page_params(params)
+
+ with {:ok, users, count} <-
+ User.search_for_admin(%{
+ query: params["query"],
+ admin: admin,
+ local: params["local_only"] == "true",
+ page: page,
+ page_size: page_size
+ }),
+ do:
+ conn
+ |> json(
+ AccountView.render("index.json",
+ users: users,
+ count: count,
+ page_size: page_size
+ )
+ )