Mastodon API, streaming: Add pleroma.direct_conversation_id to the conversation stream event payload.
This commit is contained in:
parent
a304a2a845
commit
ed29be24cb
6 changed files with 45 additions and 6 deletions
|
|
@ -34,7 +34,11 @@ defmodule Pleroma.Web.MastodonAPI.ConversationView do
|
|||
id: participation.id |> to_string(),
|
||||
accounts: render(AccountView, "index.json", users: users, as: :user),
|
||||
unread: !participation.read,
|
||||
last_status: render(StatusView, "show.json", activity: activity, for: user)
|
||||
last_status:
|
||||
render(StatusView, "show.json",
|
||||
activity: activity,
|
||||
direct_conversation_id: participation.id
|
||||
)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -243,7 +243,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||
end
|
||||
|
||||
direct_conversation_id =
|
||||
with {_, true} <- {:include_id, opts[:with_direct_conversation_id]},
|
||||
with {_, nil} <- {:direct_conversation_id, opts[:direct_conversation_id]},
|
||||
{_, true} <- {:include_id, opts[:with_direct_conversation_id]},
|
||||
{_, %User{} = for_user} <- {:for_user, opts[:for]},
|
||||
%{data: %{"context" => context}} when is_binary(context) <- activity,
|
||||
%Conversation{} = conversation <- Conversation.get_for_ap_id(context),
|
||||
|
|
@ -251,6 +252,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||
Participation.for_user_and_conversation(for_user, conversation) do
|
||||
participation_id
|
||||
else
|
||||
{:direct_conversation_id, participation_id} when is_integer(participation_id) ->
|
||||
participation_id
|
||||
|
||||
_e ->
|
||||
nil
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue