diff --git a/api/funkwhale_api/federation/routes.py b/api/funkwhale_api/federation/routes.py index b757d4f9279b8968cc649f4cbd4c5058e4836f99..d8877de1fd1c7bbcf81859d27ed6a9725895cc06 100644 --- a/api/funkwhale_api/federation/routes.py +++ b/api/funkwhale_api/federation/routes.py @@ -82,7 +82,7 @@ def inbox_undo_follow(payload, context): serializer = serializers.UndoFollowSerializer(data=payload, context=context) if not serializer.is_valid(raise_exception=context.get("raise_exception", False)): logger.debug( - "Discarding invalid follow undo from {}: %s", + "Discarding invalid follow undo from %s: %s", context["actor"].fid, serializer.errors, ) diff --git a/api/funkwhale_api/federation/serializers.py b/api/funkwhale_api/federation/serializers.py index 61574a57e539e61128ddfb7a1adde7c6b41afbee..9f4bad010ee406070a74983ff4ba7a80d5377298 100644 --- a/api/funkwhale_api/federation/serializers.py +++ b/api/funkwhale_api/federation/serializers.py @@ -560,7 +560,7 @@ class LibrarySerializer(PaginatedCollectionSerializer): r = super().to_representation(conf) r["audience"] = ( "https://www.w3.org/ns/activitystreams#Public" - if library.privacy_level == "public" + if library.privacy_level == "everyone" else "" ) r["followers"] = library.followers_url diff --git a/api/tests/federation/test_serializers.py b/api/tests/federation/test_serializers.py index c43647070116d9beec041b6543bd28e6033a1a2a..d3441df5daf44f7f47b0b35103b42da564230a04 100644 --- a/api/tests/federation/test_serializers.py +++ b/api/tests/federation/test_serializers.py @@ -476,7 +476,7 @@ def test_collection_page_serializer(factories): def test_music_library_serializer_to_ap(factories): - library = factories["music.Library"]() + library = factories["music.Library"](privacy_level="everyone") # pending, errored and skippednot included factories["music.Upload"](import_status="pending") factories["music.Upload"](import_status="errored") @@ -488,11 +488,11 @@ def test_music_library_serializer_to_ap(factories): "https://w3id.org/security/v1", {}, ], + "audience": "https://www.w3.org/ns/activitystreams#Public", "type": "Library", "id": library.fid, "name": library.name, "summary": library.description, - "audience": "", "actor": library.actor.fid, "totalItems": 0, "current": library.fid + "?page=1", diff --git a/changes/changelog.d/553.bugfix b/changes/changelog.d/553.bugfix new file mode 100644 index 0000000000000000000000000000000000000000..3747bf62e4161ef4fce53b260e0605cba376aacb --- /dev/null +++ b/changes/changelog.d/553.bugfix @@ -0,0 +1 @@ +Advertise public libraries properly in ActivityPub representations (#553)