commit: 670a77ecbc94d57c6ecb5e569597e81cee4b5532
parent 1417627d07a29e06efec2b282405e72bcfb1269c
Author: kaniini <nenolod@gmail.com>
Date:   Tue,  9 Jul 2019 17:53:41 +0000
Merge branch 'feature/allow-user-query-via-id' into 'develop'
Admin API: Allow querying user by ID
See merge request pleroma/pleroma!1380
Diffstat:
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -8,9 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - MRF: Support for priming the mediaproxy cache (`Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy`)
 Configuration: `federation_incoming_replies_max_depth` option
 - 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)
+- Mastodon API, streaming: Add support for passing the token in the `Sec-WebSocket-Protocol` header
 - Admin API: Return users' tags when querying reports
 - Admin API: Return avatar and display name when querying users
-- Mastodon API, streaming: Add support for passing the token in the `Sec-WebSocket-Protocol` header
+- Admin API: Allow querying user by ID
 - Added synchronization of following/followers counters for external users
 
 ### Fixed
diff --git a/docs/api/admin_api.md b/docs/api/admin_api.md
@@ -176,13 +176,13 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
   - `nickname`
   - `status` BOOLEAN field, false value means deactivation.
 
-## `/api/pleroma/admin/users/:nickname`
+## `/api/pleroma/admin/users/:nickname_or_id`
 
 ### Retrive the details of a user
 
 - Method: `GET`
 - Params:
-  - `nickname`
+  - `nickname` or `id`
 - Response:
   - On failure: `Not found`
   - On success: JSON of the user
diff --git a/lib/pleroma/web/admin_api/admin_api_controller.ex b/lib/pleroma/web/admin_api/admin_api_controller.ex
@@ -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