ChatMessageReferences: Adjust views

This commit is contained in:
lain 2020-06-03 12:49:53 +02:00
commit f3ccd50a33
6 changed files with 34 additions and 11 deletions

View file

@ -7,6 +7,7 @@ defmodule Pleroma.Web.StreamerView do
alias Pleroma.Activity
alias Pleroma.Chat
alias Pleroma.ChatMessageReference
alias Pleroma.Conversation.Participation
alias Pleroma.Notification
alias Pleroma.User
@ -15,10 +16,15 @@ defmodule Pleroma.Web.StreamerView do
def render("chat_update.json", object, user, recipients) do
chat = Chat.get(user.id, hd(recipients -- [user.ap_id]))
# Explicitly giving the cmr for the object here, so we don't accidentally
# send a later 'last_message' that was inserted between inserting this and
# streaming it out
cm_ref = ChatMessageReference.for_chat_and_object(chat, object)
representation =
Pleroma.Web.PleromaAPI.ChatView.render(
"show.json",
%{message: object, chat: chat}
%{last_message: cm_ref, chat: chat}
)
%{