X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Factivity_pub%2Factivity_pub.ex;h=421fd5cd72583b1f5d64dafbbcc72f93080af7b4;hb=a89a613e4e070e09e0dd5d040060ace622aac6aa;hp=4aade6e40195d56c599804d172e95d99cb696128;hpb=a6f65083aeed755d31134144b973d87575ae549e;p=akkoma diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 4aade6e40..421fd5cd7 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -10,6 +10,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do :ok <- insert_full_object(map) do {:ok, activity} = Repo.insert(%Activity{data: map, local: local, actor: map["actor"]}) Notification.create_notifications(activity) + stream_out(activity) {:ok, activity} else %Activity{} = activity -> {:ok, activity} @@ -17,17 +18,22 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do end end - def create(to, actor, context, object, additional \\ %{}, published \\ nil, local \\ true) do - with create_data <- make_create_data(%{to: to, actor: actor, published: published, context: context, object: object}, additional), - {:ok, activity} <- insert(create_data, local), - :ok <- maybe_federate(activity) do - if activity.data["type"] == "Create" and Enum.member?(activity.data["to"], "https://www.w3.org/ns/activitystreams#Public") do + def stream_out(activity) do + if activity.data["type"] in ["Create", "Announce"] do + Pleroma.Web.Streamer.stream("user", activity) + if Enum.member?(activity.data["to"], "https://www.w3.org/ns/activitystreams#Public") do Pleroma.Web.Streamer.stream("public", activity) - Pleroma.Web.Streamer.stream("user", activity) - if local do + if activity.local do Pleroma.Web.Streamer.stream("public:local", activity) end end + end + end + + def create(to, actor, context, object, additional \\ %{}, published \\ nil, local \\ true) do + with create_data <- make_create_data(%{to: to, actor: actor, published: published, context: context, object: object}, additional), + {:ok, activity} <- insert(create_data, local), + :ok <- maybe_federate(activity) do {:ok, activity} end end