Allow pin data fetching to fail

This commit is contained in:
tusooa 2023-08-15 10:22:14 +01:00 committed by FloatingGhost
parent cc858f6d74
commit f502954f16
2 changed files with 13 additions and 0 deletions

View File

@ -1792,6 +1792,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
end)
end
def pin_data_from_featured_collection(obj) do
Logger.error("Could not parse featured collection #{inspect(obj)}")
%{}
end
def fetch_and_prepare_featured_from_ap_id(nil) do
{:ok, %{}}
end

View File

@ -2629,6 +2629,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
assert user.name == " "
end
test "pin_data_from_featured_collection will ignore unsupported values" do
assert %{} ==
ActivityPub.pin_data_from_featured_collection(%{
"type" => "CollectionThatIsNotRealAndCannotHurtMe",
"first" => "https://social.example/users/alice/collections/featured?page=true"
})
end
describe "persist/1" do
test "should not persist remote delete activities" do
poster = insert(:user, local: false)