From 3438a120cc37d696eba711eaf7be119dbba1381f Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Mon, 4 Sep 2017 20:47:43 +0200 Subject: [PATCH] Don't delete new delete activity... --- lib/pleroma/web/activity_pub/activity_pub.ex | 8 ++++---- test/web/activity_pub/activity_pub_test.exs | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 146888c98..db1302738 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -83,11 +83,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do "object" => id, "to" => [user.follower_address, "https://www.w3.org/ns/activitystreams#Public"] } - with {:ok, activity} <- insert(data, local), + with Repo.delete(object), + Repo.delete_all(Activity.all_non_create_by_object_ap_id_q(id)), + Repo.delete_all(Activity.all_by_object_ap_id_q(id)), + {:ok, activity} <- insert(data, local), :ok <- maybe_federate(activity) do - Repo.delete(object) - Repo.delete_all(Activity.all_non_create_by_object_ap_id_q(id)) - Repo.delete_all(Activity.all_by_object_ap_id_q(id)) {:ok, activity} end end diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index 4388215f8..a088e97be 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -256,6 +256,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do assert delete.data["actor"] == note.data["actor"] assert delete.data["object"] == note.data["object"]["id"] + assert Repo.get(Activity, delete.id) != nil + assert Repo.get(Object, object.id) == nil end end -- 2.45.2