diff --git a/api/funkwhale_api/federation/jsonld.py b/api/funkwhale_api/federation/jsonld.py index 05a438606..4a23ae418 100644 --- a/api/funkwhale_api/federation/jsonld.py +++ b/api/funkwhale_api/federation/jsonld.py @@ -220,16 +220,11 @@ def get_default_context(): return [ "https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1", - {"manuallyApprovesFollowers": "as:manuallyApprovesFollowers"}, - ] - - -def get_default_context_fw(): - return [ - "https://www.w3.org/ns/activitystreams", - "https://w3id.org/security/v1", - {"manuallyApprovesFollowers": "as:manuallyApprovesFollowers"}, "https://funkwhale.audio/ns", + { + "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", + "Hashtag": "as:Hashtag", + }, ] diff --git a/api/tests/federation/test_serializers.py b/api/tests/federation/test_serializers.py index 6411dd1cd..ccf6a796d 100644 --- a/api/tests/federation/test_serializers.py +++ b/api/tests/federation/test_serializers.py @@ -21,7 +21,7 @@ def test_actor_serializer_from_ap(db): private, public = keys.get_key_pair() actor_url = "https://test.federation/actor" payload = { - "@context": jsonld.get_default_context_fw(), + "@context": jsonld.get_default_context(), "id": actor_url, "type": "Person", "outbox": "https://test.com/outbox", @@ -76,7 +76,7 @@ def test_actor_serializer_from_ap_no_icon_mediaType(db): private, public = keys.get_key_pair() actor_url = "https://test.federation/actor" payload = { - "@context": jsonld.get_default_context_fw(), + "@context": jsonld.get_default_context(), "id": actor_url, "type": "Person", "inbox": "https://test.com/inbox", @@ -281,7 +281,7 @@ def test_accept_follow_serializer_save(factories): follow = factories["federation.Follow"](approved=None) data = { - "@context": jsonld.get_default_context_fw(), + "@context": jsonld.get_default_context(), "id": follow.get_federation_id() + "/accept", "type": "Accept", "actor": follow.target.fid, @@ -301,7 +301,7 @@ def test_accept_follow_serializer_validates_on_context(factories): follow = factories["federation.Follow"](approved=None) impostor = factories["federation.Actor"]() data = { - "@context": jsonld.get_default_context_fw(), + "@context": jsonld.get_default_context(), "id": follow.get_federation_id() + "/accept", "type": "Accept", "actor": impostor.url, @@ -337,7 +337,7 @@ def test_undo_follow_serializer_save(factories): follow = factories["federation.Follow"](approved=True) data = { - "@context": jsonld.get_default_context_fw(), + "@context": jsonld.get_default_context(), "id": follow.get_federation_id() + "/undo", "type": "Undo", "actor": follow.actor.fid, @@ -356,7 +356,7 @@ def test_undo_follow_serializer_validates_on_context(factories): follow = factories["federation.Follow"](approved=True) impostor = factories["federation.Actor"]() data = { - "@context": jsonld.get_default_context_fw(), + "@context": jsonld.get_default_context(), "id": follow.get_federation_id() + "/undo", "type": "Undo", "actor": impostor.url, @@ -402,7 +402,7 @@ def test_paginated_collection_serializer(factories): def test_paginated_collection_serializer_validation(): data = { - "@context": jsonld.get_default_context_fw(), + "@context": jsonld.get_default_context(), "type": "Collection", "id": "https://test.federation/test", "totalItems": 5, @@ -579,7 +579,7 @@ def test_music_library_serializer_from_private(factories, mocker): "funkwhale_api.federation.utils.retrieve_ap_object", return_value=actor ) data = { - "@context": jsonld.get_default_context_fw(), + "@context": jsonld.get_default_context(), "audience": "", "name": "Hello", "summary": "World", diff --git a/api/tests/federation/test_tasks.py b/api/tests/federation/test_tasks.py index de90f2886..f6aef6eba 100644 --- a/api/tests/federation/test_tasks.py +++ b/api/tests/federation/test_tasks.py @@ -389,7 +389,7 @@ def test_fetch_success(factories, r_mock, mocker): tasks.fetch(fetch_id=fetch.pk) fetch.refresh_from_db() - payload["@context"].append("https://funkwhale.audio/ns") + assert fetch.status == "finished" assert init.call_count == 1 assert init.call_args[0][1] == artist @@ -421,7 +421,7 @@ def test_fetch_webfinger(factories, r_mock, mocker): tasks.fetch(fetch_id=fetch.pk) fetch.refresh_from_db() - payload["@context"].append("https://funkwhale.audio/ns") + assert fetch.status == "finished" assert fetch.object == actor assert init.call_count == 1 @@ -451,7 +451,7 @@ def test_fetch_rel_alternate(factories, r_mock, mocker): tasks.fetch(fetch_id=fetch.pk) fetch.refresh_from_db() - ap_payload["@context"].append("https://funkwhale.audio/ns") + assert fetch.status == "finished" assert fetch.object == actor assert init.call_count == 1 @@ -482,7 +482,7 @@ def test_fetch_url(factory_name, serializer_class, factories, r_mock, mocker): tasks.fetch(fetch_id=fetch.pk) fetch.refresh_from_db() - payload["@context"].append("https://funkwhale.audio/ns") + assert fetch.status == "finished" assert fetch.object == obj assert init.call_count == 1