Commit 51457aa8 authored by Eliot Berriot's avatar Eliot Berriot 💬

Fix #553: Advertise public libraries properly in ActivityPub representations

parent a7956ca1
......@@ -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,
)
......
......@@ -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
......
......@@ -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",
......
Advertise public libraries properly in ActivityPub representations (#553)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment