diff options
author | lain <lain@soykaf.club> | 2019-12-06 13:48:37 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-12-06 13:48:37 +0000 |
commit | a280be34e36223aefd3d5e26fcddb9faad77310b (patch) | |
tree | edc39a1b48f48334480e709fbda844cb120b32f8 /test | |
parent | 67d8df04a440ec9b2949bdddd3a3d8dd70c9b140 (diff) | |
parent | cdff5b82670313e46c2b362d4cf041779af6a6bd (diff) | |
download | pleroma-a280be34e36223aefd3d5e26fcddb9faad77310b.tar.gz |
Merge branch 'fix/mrf-delete' into 'develop'
ActivityPub: Fix deletes being exempt from MRF
Closes #1461
See merge request pleroma/pleroma!2037
Diffstat (limited to 'test')
-rw-r--r-- | test/web/activity_pub/activity_pub_controller_test.exs | 2 | ||||
-rw-r--r-- | test/web/activity_pub/activity_pub_test.exs | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/test/web/activity_pub/activity_pub_controller_test.exs b/test/web/activity_pub/activity_pub_controller_test.exs index 1aa73d75c..ba2ce1dd9 100644 --- a/test/web/activity_pub/activity_pub_controller_test.exs +++ b/test/web/activity_pub/activity_pub_controller_test.exs @@ -298,7 +298,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do assert json_response(conn1, :ok) assert Enum.any?(conn1.resp_headers, &(&1 == {"x-cache", "MISS from Pleroma"})) - Activity.delete_by_ap_id(activity.object.data["id"]) + Activity.delete_all_by_object_ap_id(activity.object.data["id"]) conn2 = conn diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index 907176119..c59ce99ac 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -1259,6 +1259,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do assert %{data: data, object: object} = Activity.get_by_ap_id_with_object(ap_id) assert object.data["repliesCount"] == 0 end + + test "it passes delete activity through MRF before deleting the object" do + rewrite_policy = Pleroma.Config.get([:instance, :rewrite_policy]) + Pleroma.Config.put([:instance, :rewrite_policy], Pleroma.Web.ActivityPub.MRF.DropPolicy) + + on_exit(fn -> Pleroma.Config.put([:instance, :rewrite_policy], rewrite_policy) end) + + note = insert(:note_activity) + object = Object.normalize(note) + + {:error, {:reject, _}} = ActivityPub.delete(object) + + assert Activity.get_by_id(note.id) + assert Repo.get(Object, object.id).data["type"] == object.data["type"] + end end describe "timeline post-processing" do |