diff options
Diffstat (limited to 'lib/pleroma/web')
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 16 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 4 | ||||
-rw-r--r-- | lib/pleroma/web/streamer.ex | 8 |
3 files changed, 17 insertions, 11 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index adb42b9ab..2f11f8984 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -311,14 +311,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do user = User.get_cached_by_ap_id(actor) to = object.data["to"] || [] ++ object.data["cc"] || [] - data = %{ - "type" => "Delete", - "actor" => actor, - "object" => id, - "to" => to - } - - with {:ok, _} <- Object.delete(object), + with {:ok, object, activity} <- Object.delete(object), + data <- %{ + "type" => "Delete", + "actor" => actor, + "object" => id, + "to" => to, + "deleted_activity_id" => activity && activity.id + }, {:ok, activity} <- insert(data, local), # Changing note count prior to enqueuing federation task in order to avoid race conditions on updating user.info {:ok, _actor} <- decrease_note_count_if_public(user, object), diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 88007aa16..27d223a3e 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -736,6 +736,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do def prepare_outgoing(%{"type" => _type} = data) do data = data + |> strip_internal_fields |> maybe_fix_object_url |> Map.merge(Utils.make_json_ld_header()) @@ -870,7 +871,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do "announcements", "announcement_count", "emoji", - "context_id" + "context_id", + "deleted_activity_id" ]) end diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex index 27e8020f4..ad888c361 100644 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@ -211,15 +211,19 @@ defmodule Pleroma.Web.Streamer do end) end - def push_to_socket(topics, topic, %Activity{id: id, data: %{"type" => "Delete"}}) do + def push_to_socket(topics, topic, %Activity{ + data: %{"type" => "Delete", "deleted_activity_id" => deleted_activity_id} + }) do Enum.each(topics[topic] || [], fn socket -> send( socket.transport_pid, - {:text, %{event: "delete", payload: to_string(id)} |> Jason.encode!()} + {:text, %{event: "delete", payload: to_string(deleted_activity_id)} |> Jason.encode!()} ) end) end + def push_to_socket(_topics, _topic, %Activity{data: %{"type" => "Delete"}}), do: :noop + def push_to_socket(topics, topic, item) do Enum.each(topics[topic] || [], fn socket -> # Get the current user so we have up-to-date blocks etc. |