From aab86698a5356e26fe68c650f277913497aac3e9 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Mon, 4 Mar 2019 10:47:04 +0100 Subject: Expand "to" of delete activities --- test/web/activity_pub/activity_pub_test.exs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index f4029896c..e607c7f4d 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -691,6 +691,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do user = Repo.get(User, user.id) assert user.info.note_count == 10 end + + test "it creates a delete activity and checks that it is also sent to users mentioned by the deleted object" do + user = insert(:user) + note = insert(:note_activity) + object = Object.get_by_ap_id(note.data["object"]["id"]) + object = Kernel.put_in(object.data["to"], [user.ap_id]) + {:ok, delete} = ActivityPub.delete(object) + + assert user.ap_id in delete.data["to"] + end end describe "timeline post-processing" do -- cgit v1.2.3 From 28d5b40d0afddaca6797e2b72c2e89624e68f967 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Tue, 5 Mar 2019 23:15:22 +0100 Subject: Add handling of objects not in database --- test/web/activity_pub/activity_pub_test.exs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index e607c7f4d..10c5258d0 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -691,12 +691,23 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do user = Repo.get(User, user.id) assert user.info.note_count == 10 end - + test "it creates a delete activity and checks that it is also sent to users mentioned by the deleted object" do user = insert(:user) note = insert(:note_activity) - object = Object.get_by_ap_id(note.data["object"]["id"]) - object = Kernel.put_in(object.data["to"], [user.ap_id]) + + {:ok, object} = + Object.get_by_ap_id(note.data["object"]["id"]) + |> Object.change(%{ + data: %{ + "actor" => note.data["object"]["actor"], + "id" => note.data["object"]["id"], + "to" => [user.ap_id], + "type" => "Note" + } + }) + |> Object.update_and_set_cache() + {:ok, delete} = ActivityPub.delete(object) assert user.ap_id in delete.data["to"] -- cgit v1.2.3