SideEffects: Ensure a chat is present before streaming something out.
authorlain <lain@soykaf.club>
Fri, 29 May 2020 14:05:02 +0000 (16:05 +0200)
committerlain <lain@soykaf.club>
Fri, 29 May 2020 14:05:02 +0000 (16:05 +0200)
lib/pleroma/web/activity_pub/side_effects.ex

index a4de8691efff236415923a9de363e7120e3c1d51..02296b210562679f1dfb7e3c0c7065f67cfde9e3 100644 (file)
@@ -127,7 +127,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects 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 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
         end
       end)
 
+      Streamer.stream(["user", "user:pleroma_chat"], object)
       {:ok, object, meta}
     end
   end