forked from potsda.mn/mobilizon
Only send Tombstone with Delete activity, not the object itself
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
26644c1677
commit
75fbcb985c
|
@ -92,7 +92,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Actors do
|
||||||
activity_data = %{
|
activity_data = %{
|
||||||
"type" => "Delete",
|
"type" => "Delete",
|
||||||
"actor" => actor_url,
|
"actor" => actor_url,
|
||||||
"object" => Convertible.model_to_as(target_actor),
|
"object" => %{
|
||||||
|
"type" => "Tombstone",
|
||||||
|
"id" => target_actor_url
|
||||||
|
},
|
||||||
"id" => target_actor_url <> "/delete",
|
"id" => target_actor_url <> "/delete",
|
||||||
"to" => to,
|
"to" => to,
|
||||||
"cc" => cc
|
"cc" => cc
|
||||||
|
|
|
@ -82,7 +82,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Comments do
|
||||||
activity_data = %{
|
activity_data = %{
|
||||||
"type" => "Delete",
|
"type" => "Delete",
|
||||||
"actor" => actor.url,
|
"actor" => actor.url,
|
||||||
"object" => Convertible.model_to_as(comment),
|
"object" => %{
|
||||||
|
"type" => "Tombstone",
|
||||||
|
"id" => url
|
||||||
|
},
|
||||||
"id" => url <> "/delete",
|
"id" => url <> "/delete",
|
||||||
"to" => ["https://www.w3.org/ns/activitystreams#Public"]
|
"to" => ["https://www.w3.org/ns/activitystreams#Public"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Discussions do
|
||||||
activity_data = %{
|
activity_data = %{
|
||||||
"type" => "Delete",
|
"type" => "Delete",
|
||||||
"actor" => actor.url,
|
"actor" => actor.url,
|
||||||
"object" => Convertible.model_to_as(discussion),
|
"object" => %{
|
||||||
|
"type" => "Tombstone",
|
||||||
|
"url" => url
|
||||||
|
},
|
||||||
"id" => url <> "/delete",
|
"id" => url <> "/delete",
|
||||||
"to" => [group.members_url]
|
"to" => [group.members_url]
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Events do
|
||||||
activity_data = %{
|
activity_data = %{
|
||||||
"type" => "Delete",
|
"type" => "Delete",
|
||||||
"actor" => actor.url,
|
"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"],
|
"to" => [actor.url <> "/followers", "https://www.w3.org/ns/activitystreams#Public"],
|
||||||
"id" => url <> "/delete"
|
"id" => url <> "/delete"
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Posts do
|
||||||
activity_data = %{
|
activity_data = %{
|
||||||
"actor" => actor_url,
|
"actor" => actor_url,
|
||||||
"type" => "Delete",
|
"type" => "Delete",
|
||||||
"object" => Convertible.model_to_as(post),
|
"object" => %{
|
||||||
|
"type" => "Tombstone",
|
||||||
|
"id" => url
|
||||||
|
},
|
||||||
"id" => url <> "/delete",
|
"id" => url <> "/delete",
|
||||||
"to" => [group_url, @public_ap, members_url]
|
"to" => [group_url, @public_ap, members_url]
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Resources do
|
||||||
"actor" => actor_url,
|
"actor" => actor_url,
|
||||||
"attributedTo" => [group_url],
|
"attributedTo" => [group_url],
|
||||||
"type" => "Delete",
|
"type" => "Delete",
|
||||||
"object" => Convertible.model_to_as(resource),
|
"object" => %{
|
||||||
|
"type" => "Tombstone",
|
||||||
|
"id" => url
|
||||||
|
},
|
||||||
"id" => url <> "/delete",
|
"id" => url <> "/delete",
|
||||||
"to" => [members_url]
|
"to" => [members_url]
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.TodoLists do
|
||||||
activity_data = %{
|
activity_data = %{
|
||||||
"actor" => actor_url,
|
"actor" => actor_url,
|
||||||
"type" => "Delete",
|
"type" => "Delete",
|
||||||
"object" => Convertible.model_to_as(todo_list),
|
"object" => %{
|
||||||
|
"type" => "Tombstone",
|
||||||
|
"id" => url
|
||||||
|
},
|
||||||
"id" => url <> "/delete",
|
"id" => url <> "/delete",
|
||||||
"to" => [group_url]
|
"to" => [group_url]
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,10 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Todos do
|
||||||
activity_data = %{
|
activity_data = %{
|
||||||
"actor" => actor_url,
|
"actor" => actor_url,
|
||||||
"type" => "Delete",
|
"type" => "Delete",
|
||||||
"object" => Convertible.model_to_as(url),
|
"object" => %{
|
||||||
|
"type" => "Tombstone",
|
||||||
|
"id" => url
|
||||||
|
},
|
||||||
"id" => "#{url}/delete",
|
"id" => "#{url}/delete",
|
||||||
"to" => [group_url]
|
"to" => [group_url]
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ defmodule Mobilizon.Federation.ActivityPubTest do
|
||||||
|
|
||||||
assert delete.data["type"] == "Delete"
|
assert delete.data["type"] == "Delete"
|
||||||
assert delete.data["actor"] == event.organizer_actor.url
|
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.data["object"]["id"] == event.url
|
||||||
|
|
||||||
assert Events.get_event_by_url(event.url) == nil
|
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["type"] == "Delete"
|
||||||
assert delete.data["actor"] == event.organizer_actor.url
|
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.data["object"]["id"] == event.url
|
||||||
assert delete.local == false
|
assert delete.local == false
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ defmodule Mobilizon.Federation.ActivityPubTest do
|
||||||
|
|
||||||
assert delete.data["type"] == "Delete"
|
assert delete.data["type"] == "Delete"
|
||||||
assert delete.data["actor"] == comment.actor.url
|
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
|
assert delete.data["object"]["id"] == comment.url
|
||||||
|
|
||||||
refute is_nil(Discussions.get_comment_from_url(comment.url).deleted_at)
|
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.local
|
||||||
assert update_data.data["type"] == "Delete"
|
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["object"]["id"] == url
|
||||||
assert update_data.data["to"] == [group.members_url]
|
assert update_data.data["to"] == [group.members_url]
|
||||||
assert update_data.data["actor"] == actor.url
|
assert update_data.data["actor"] == actor.url
|
||||||
|
|
Loading…
Reference in a new issue