Mastodon API, streaming: Add pleroma.direct_conversation_id to the conversation stream event payload.

This commit is contained in:
eugenijm 2019-10-31 03:44:27 +03:00
commit ed29be24cb
6 changed files with 45 additions and 6 deletions

View file

@ -7,6 +7,7 @@ defmodule Pleroma.Web.StreamerTest do
import Pleroma.Factory
alias Pleroma.Conversation.Participation
alias Pleroma.List
alias Pleroma.User
alias Pleroma.Web.CommonAPI
@ -481,7 +482,14 @@ defmodule Pleroma.Web.StreamerTest do
task =
Task.async(fn ->
assert_receive {:text, _received_event}, 4_000
assert_receive {:text, received_event}, 4_000
assert %{"event" => "conversation", "payload" => received_payload} =
Jason.decode!(received_event)
assert %{"last_status" => last_status} = Jason.decode!(received_payload)
[participation] = Participation.for_user(user)
assert last_status["pleroma"]["direct_conversation_id"] == participation.id
end)
Streamer.add_socket(
@ -498,7 +506,7 @@ defmodule Pleroma.Web.StreamerTest do
Task.await(task)
end
test "it doesn't send conversation update to the 'direct' streamj when the last message in the conversation is deleted" do
test "it doesn't send conversation update to the 'direct' stream when the last message in the conversation is deleted" do
user = insert(:user)
another_user = insert(:user)