SideEffects: Ensure a chat is present before streaming something out.

This commit is contained in:
lain 2020-05-29 16:05:02 +02:00
parent b08baf905b
commit 3898dd69a6

View file

@ -127,7 +127,6 @@ def handle(object, meta) do
def handle_object_creation(%{"type" => "ChatMessage"} = object, meta) do
with {:ok, object, meta} <- Pipeline.common_pipeline(object, meta) do
Streamer.stream(["user", "user:pleroma_chat"], object)
actor = User.get_cached_by_ap_id(object.data["actor"])
recipient = User.get_cached_by_ap_id(hd(object.data["to"]))
@ -142,6 +141,7 @@ def handle_object_creation(%{"type" => "ChatMessage"} = object, meta) do
end
end)
Streamer.stream(["user", "user:pleroma_chat"], object)
{:ok, object, meta}
end
end