StreamerView: Actually send Chats, not ChatMessages.
authorlain <lain@soykaf.club>
Fri, 29 May 2020 14:02:45 +0000 (16:02 +0200)
committerlain <lain@soykaf.club>
Fri, 29 May 2020 14:02:45 +0000 (16:02 +0200)
lib/pleroma/web/pleroma_api/views/chat_view.ex
lib/pleroma/web/views/streamer_view.ex

index 08d5110c3ef954c8c28ec695c6f8b402d308e335..223b6498717f06349deb526098a9981b7f9a8a1e 100644 (file)
@@ -14,7 +14,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatView do
   def render("show.json", %{chat: %Chat{} = chat} = opts) do
     recipient = User.get_cached_by_ap_id(chat.recipient)
 
-    last_message = Chat.last_message_for_chat(chat)
+    last_message = opts[:message] || Chat.last_message_for_chat(chat)
 
     %{
       id: chat.id |> to_string(),
index 949e2ed374076c2634553d6f63c083d867a15be0..5e953d7706d6c9ff161966110764edd83d7ada41 100644 (file)
@@ -16,9 +16,9 @@ defmodule Pleroma.Web.StreamerView do
     chat = Chat.get(user.id, hd(recipients -- [user.ap_id]))
 
     representation =
-      Pleroma.Web.PleromaAPI.ChatMessageView.render(
+      Pleroma.Web.PleromaAPI.ChatView.render(
         "show.json",
-        %{object: object, chat: chat}
+        %{message: object, chat: chat}
       )
 
     %{