Only send Tombstone with Delete activity, not the object itself

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-11-03 17:45:32 +01:00
parent 26644c1677
commit 75fbcb985c
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
9 changed files with 36 additions and 12 deletions

View File

@ -92,7 +92,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Actors do
activity_data = %{
"type" => "Delete",
"actor" => actor_url,
"object" => Convertible.model_to_as(target_actor),
"object" => %{
"type" => "Tombstone",
"id" => target_actor_url
},
"id" => target_actor_url <> "/delete",
"to" => to,
"cc" => cc

View File

@ -82,7 +82,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Comments do
activity_data = %{
"type" => "Delete",
"actor" => actor.url,
"object" => Convertible.model_to_as(comment),
"object" => %{
"type" => "Tombstone",
"id" => url
},
"id" => url <> "/delete",
"to" => ["https://www.w3.org/ns/activitystreams#Public"]
}

View File

@ -115,7 +115,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Discussions do
activity_data = %{
"type" => "Delete",
"actor" => actor.url,
"object" => Convertible.model_to_as(discussion),
"object" => %{
"type" => "Tombstone",
"url" => url
},
"id" => url <> "/delete",
"to" => [group.members_url]
}

View File

@ -73,7 +73,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Events do
activity_data = %{
"type" => "Delete",
"actor" => actor.url,
"object" => Convertible.model_to_as(event),
"object" => %{
"type" => "Tombstone",
"id" => url
},
"to" => [actor.url <> "/followers", "https://www.w3.org/ns/activitystreams#Public"],
"id" => url <> "/delete"
}

View File

@ -77,7 +77,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Posts do
activity_data = %{
"actor" => actor_url,
"type" => "Delete",
"object" => Convertible.model_to_as(post),
"object" => %{
"type" => "Tombstone",
"id" => url
},
"id" => url <> "/delete",
"to" => [group_url, @public_ap, members_url]
}

View File

@ -161,7 +161,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Resources do
"actor" => actor_url,
"attributedTo" => [group_url],
"type" => "Delete",
"object" => Convertible.model_to_as(resource),
"object" => %{
"type" => "Tombstone",
"id" => url
},
"id" => url <> "/delete",
"to" => [members_url]
}

View File

@ -55,7 +55,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.TodoLists do
activity_data = %{
"actor" => actor_url,
"type" => "Delete",
"object" => Convertible.model_to_as(todo_list),
"object" => %{
"type" => "Tombstone",
"id" => url
},
"id" => url <> "/delete",
"to" => [group_url]
}

View File

@ -95,7 +95,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Todos do
activity_data = %{
"actor" => actor_url,
"type" => "Delete",
"object" => Convertible.model_to_as(url),
"object" => %{
"type" => "Tombstone",
"id" => url
},
"id" => "#{url}/delete",
"to" => [group_url]
}

View File

@ -121,7 +121,7 @@ defmodule Mobilizon.Federation.ActivityPubTest do
assert delete.data["type"] == "Delete"
assert delete.data["actor"] == event.organizer_actor.url
assert delete.data["object"]["type"] == "Event"
assert delete.data["object"]["type"] == "Tombstone"
assert delete.data["object"]["id"] == event.url
assert Events.get_event_by_url(event.url) == nil
@ -137,7 +137,7 @@ defmodule Mobilizon.Federation.ActivityPubTest do
assert delete.data["type"] == "Delete"
assert delete.data["actor"] == event.organizer_actor.url
assert delete.data["object"]["type"] == "Event"
assert delete.data["object"]["type"] == "Tombstone"
assert delete.data["object"]["id"] == event.url
assert delete.local == false
@ -155,7 +155,7 @@ defmodule Mobilizon.Federation.ActivityPubTest do
assert delete.data["type"] == "Delete"
assert delete.data["actor"] == comment.actor.url
assert delete.data["object"]["type"] == "Note"
assert delete.data["object"]["type"] == "Tombstone"
assert delete.data["object"]["id"] == comment.url
refute is_nil(Discussions.get_comment_from_url(comment.url).deleted_at)
@ -486,7 +486,7 @@ defmodule Mobilizon.Federation.ActivityPubTest do
assert update_data.local
assert update_data.data["type"] == "Delete"
assert update_data.data["object"]["type"] == "Document"
assert update_data.data["object"]["type"] == "Tombstone"
assert update_data.data["object"]["id"] == url
assert update_data.data["to"] == [group.members_url]
assert update_data.data["actor"] == actor.url