use Pleroma.Web, :view
alias Pleroma.Chat
+ alias Pleroma.User
+ alias Pleroma.Web.MastodonAPI.AccountView
+
+ def render("show.json", %{chat: %Chat{} = chat} = opts) do
+ recipient = User.get_cached_by_ap_id(chat.recipient)
- def render("show.json", %{chat: %Chat{} = chat}) do
%{
- id: chat.id,
- recipient: chat.recipient,
+ id: chat.id |> to_string(),
+ account: AccountView.render("show.json", Map.put(opts, :user, recipient)),
unread: chat.unread
}
end