Merge branch 'activitypub-tombstone-fix' into 'develop'
Don't crash on AP request for tombstone See merge request pleroma/pleroma!630
This commit is contained in:
commit
576368237c
@ -801,6 +801,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def is_public?(%Object{data: %{"type" => "Tombstone"}}) do
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
def is_public?(activity) do
|
def is_public?(activity) do
|
||||||
"https://www.w3.org/ns/activitystreams#Public" in (activity.data["to"] ++
|
"https://www.w3.org/ns/activitystreams#Public" in (activity.data["to"] ++
|
||||||
(activity.data["cc"] || []))
|
(activity.data["cc"] || []))
|
||||||
|
@ -57,6 +57,19 @@ defmodule Pleroma.Factory do
|
|||||||
%Pleroma.Object{data: Map.merge(data, %{"to" => [user2.ap_id]})}
|
%Pleroma.Object{data: Map.merge(data, %{"to" => [user2.ap_id]})}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tombstone_factory do
|
||||||
|
data = %{
|
||||||
|
"type" => "Tombstone",
|
||||||
|
"id" => Pleroma.Web.ActivityPub.Utils.generate_object_id(),
|
||||||
|
"formerType" => "Note",
|
||||||
|
"deleted" => DateTime.utc_now() |> DateTime.to_iso8601()
|
||||||
|
}
|
||||||
|
|
||||||
|
%Pleroma.Object{
|
||||||
|
data: data
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def direct_note_activity_factory do
|
def direct_note_activity_factory do
|
||||||
dm = insert(:direct_note)
|
dm = insert(:direct_note)
|
||||||
|
|
||||||
|
@ -75,6 +75,18 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
|
|||||||
|
|
||||||
assert json_response(conn, 404)
|
assert json_response(conn, 404)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it returns 404 for tombstone objects", %{conn: conn} do
|
||||||
|
tombstone = insert(:tombstone)
|
||||||
|
uuid = String.split(tombstone.data["id"], "/") |> List.last()
|
||||||
|
|
||||||
|
conn =
|
||||||
|
conn
|
||||||
|
|> put_req_header("accept", "application/activity+json")
|
||||||
|
|> get("/objects/#{uuid}")
|
||||||
|
|
||||||
|
assert json_response(conn, 404)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "/inbox" do
|
describe "/inbox" do
|
||||||
|
Loading…
Reference in New Issue
Block a user