Add "formerType" and "delete" attributes on Tombstones objects

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-11-16 11:56:15 +01:00
parent 2032586352
commit 446c5f00ab
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
8 changed files with 18 additions and 1 deletions

View file

@ -98,6 +98,8 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Actors do
"actor" => actor_url,
"object" => %{
"type" => "Tombstone",
"formerType" => to_string(type),
"deleted" => DateTime.utc_now(),
"id" => target_actor_url
},
"id" => target_actor_url <> "/delete",

View file

@ -84,6 +84,8 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Comments do
"actor" => actor.url,
"object" => %{
"type" => "Tombstone",
"formerType" => "Note",
"deleted" => DateTime.utc_now(),
"id" => url
},
"id" => url <> "/delete",

View file

@ -117,6 +117,8 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Discussions do
"actor" => actor.url,
"object" => %{
"type" => "Tombstone",
"formerType" => "Note",
"deleted" => DateTime.utc_now(),
"url" => url
},
"id" => url <> "/delete",

View file

@ -84,6 +84,8 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Events do
"actor" => actor.url,
"object" => %{
"type" => "Tombstone",
"formerType" => "Event",
"deleted" => DateTime.utc_now(),
"id" => url
},
"to" => [actor.url <> "/followers", "https://www.w3.org/ns/activitystreams#Public"],

View file

@ -79,6 +79,8 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Posts do
"type" => "Delete",
"object" => %{
"type" => "Tombstone",
"formerType" => "Article",
"deleted" => DateTime.utc_now(),
"id" => url
},
"id" => url <> "/delete",

View file

@ -150,7 +150,8 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Resources do
@spec delete(Resource.t(), Actor.t(), boolean, map()) ::
{:ok, ActivityStream.t(), Actor.t(), Resource.t()} | {:error, Ecto.Changeset.t()}
def delete(
%Resource{url: url, actor: %Actor{url: group_url, members_url: members_url}} = resource,
%Resource{url: url, type: type, actor: %Actor{url: group_url, members_url: members_url}} =
resource,
%Actor{url: actor_url} = actor,
_local,
_additionnal
@ -163,6 +164,8 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Resources do
"type" => "Delete",
"object" => %{
"type" => "Tombstone",
"formerType" => if(type == :folder, do: "ResourceCollection", else: "Document"),
"deleted" => DateTime.utc_now(),
"id" => url
},
"id" => url <> "/delete",

View file

@ -57,6 +57,8 @@ defmodule Mobilizon.Federation.ActivityPub.Types.TodoLists do
"type" => "Delete",
"object" => %{
"type" => "Tombstone",
"formerType" => "TodoList",
"deleted" => DateTime.utc_now(),
"id" => url
},
"id" => url <> "/delete",

View file

@ -97,6 +97,8 @@ defmodule Mobilizon.Federation.ActivityPub.Types.Todos do
"type" => "Delete",
"object" => %{
"type" => "Tombstone",
"formerType" => "Todo",
"deleted" => DateTime.utc_now(),
"id" => url
},
"id" => "#{url}/delete",