diff options
author | Alex Gleason <alex@alexgleason.me> | 2020-09-01 19:49:46 -0500 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2020-09-11 14:10:28 -0500 |
commit | 9dd0b23da424c380a37897d8bf69ab241efa6f91 (patch) | |
tree | f76c9f99f4e27aeb03d082306d18219e0fd9b19c /lib/pleroma/web/admin_api/controllers | |
parent | f13b52a703d5c60cf12b2fff69f458e5c467c783 (diff) | |
download | pleroma-9dd0b23da424c380a37897d8bf69ab241efa6f91.tar.gz |
AdminAPI: show chat
Diffstat (limited to 'lib/pleroma/web/admin_api/controllers')
-rw-r--r-- | lib/pleroma/web/admin_api/controllers/chat_controller.ex | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/pleroma/web/admin_api/controllers/chat_controller.ex b/lib/pleroma/web/admin_api/controllers/chat_controller.ex index b423188d7..ac362c430 100644 --- a/lib/pleroma/web/admin_api/controllers/chat_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/chat_controller.ex @@ -13,6 +13,7 @@ defmodule Pleroma.Web.AdminAPI.ChatController do alias Pleroma.Plugs.OAuthScopesPlug alias Pleroma.Web.CommonAPI alias Pleroma.Web.PleromaAPI.Chat.MessageReferenceView + alias Pleroma.Web.PleromaAPI.ChatView require Logger @@ -20,7 +21,7 @@ defmodule Pleroma.Web.AdminAPI.ChatController do plug( OAuthScopesPlug, - %{scopes: ["read:chats"], admin: true} when action in [:messages] + %{scopes: ["read:chats"], admin: true} when action in [:show, :messages] ) plug( @@ -61,4 +62,12 @@ defmodule Pleroma.Web.AdminAPI.ChatController do |> json(%{error: "not found"}) end end + + def show(conn, %{id: id}) do + with %Chat{} = chat <- Chat.get_by_id(id) do + conn + |> put_view(ChatView) + |> render("show.json", chat: chat) + end + end end |