Admin API: Allow querying user by ID
authorMaxim Filippov <colixer@gmail.com>
Fri, 5 Jul 2019 16:33:53 +0000 (19:33 +0300)
committerMaxim Filippov <colixer@gmail.com>
Fri, 5 Jul 2019 16:33:53 +0000 (19:33 +0300)
CHANGELOG.md
docs/api/admin_api.md
lib/pleroma/web/admin_api/admin_api_controller.ex

index 3dbbd822579e1266c2a1e78f8b03b81c8316cafa..86991efe938a4b984ca71b84b01bf6efdf41c617 100644 (file)
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Mastodon API: Support for the [`tagged` filter](https://github.com/tootsuite/mastodon/pull/9755) in [`GET /api/v1/accounts/:id/statuses`](https://docs.joinmastodon.org/api/rest/accounts/#get-api-v1-accounts-id-statuses)
 - Admin API: Return users' tags when querying reports
 - Admin API: Return avatar and display name when querying users
+- Admin API: Allow querying user by ID
 
 ### Fixed
 - Not being able to pin unlisted posts
index 74bde3ecedf7351dad8221ada16c6db0d4c5179a..02baa09ed4ec798ad6088447cfbbf50dd5ca9755 100644 (file)
@@ -187,6 +187,17 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
   - On failure: `Not found`
   - On success: JSON of the user
 
+## `/api/pleroma/admin/users/:id`
+
+### Retrive the details of a user
+
+- Method: `GET`
+- Params:
+  - `id`
+- Response:
+  - On failure: `Not found`
+  - On success: JSON of the user
+
 ## `/api/pleroma/admin/relay`
 
 ### Follow a Relay
index 498beb56a02df7c05d01466414b1778e7cb2ced1..0a2482a8c85c45224d8d2916f503f8778ed4c381 100644 (file)
@@ -74,7 +74,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
   end
 
   def user_show(conn, %{"nickname" => nickname}) do
-    with %User{} = user <- User.get_cached_by_nickname(nickname) do
+    with %User{} = user <- User.get_cached_by_nickname_or_id(nickname) do
       conn
       |> json(AccountView.render("show.json", %{user: user}))
     else