Merge branch 'ap-improvements' into 'master'
ActivityPub bug fixes Closes #889 See merge request framasoft/mobilizon!1094
This commit is contained in:
commit
f6aaf493c0
|
@ -28,6 +28,19 @@ defmodule Mobilizon.Federation.ActivityPub.Publisher do
|
|||
Relay.publish(activity)
|
||||
end
|
||||
|
||||
recipients =
|
||||
if public && Config.get([:instance, :allow_relay]) do
|
||||
followers_url = Relay.get_actor().followers_url
|
||||
|
||||
Logger.debug(
|
||||
"Public activity, so adding relay followers URL to recipients: #{inspect(followers_url)}"
|
||||
)
|
||||
|
||||
recipients ++ [followers_url]
|
||||
else
|
||||
recipients
|
||||
end
|
||||
|
||||
recipients = Enum.uniq(recipients)
|
||||
|
||||
{recipients, followers} = convert_followers_in_recipients(recipients)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue