SideEffects: Stream out deletes.

This commit is contained in:
lain 2020-04-30 17:58:09 +02:00
parent 4500fdc04c
commit c832d96fc9

View File

@ -9,6 +9,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
alias Pleroma.Object
alias Pleroma.User
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.ActivityPub
def handle(object, meta \\ [])
@ -40,9 +41,12 @@ def handle(%{data: %{"type" => "Delete", "object" => deleted_object}} = object,
result =
case deleted_object do
%Object{} ->
with {:ok, _, activity} <- Object.delete(deleted_object),
with {:ok, deleted_object, activity} <- Object.delete(deleted_object),
%User{} = user <- User.get_cached_by_ap_id(deleted_object.data["actor"]) do
User.remove_pinnned_activity(user, activity)
ActivityPub.stream_out(object)
ActivityPub.stream_out_participations(deleted_object, user)
:ok
end