ChatMessageReferences: Adjust views
This commit is contained in:
parent
aa22fce8f4
commit
f3ccd50a33
6 changed files with 34 additions and 11 deletions
|
|
@ -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}
|
||||
)
|
||||
|
||||
%{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue