Fix #553: Advertise public libraries properly in ActivityPub representations
This commit is contained in:
parent
a7956ca1fe
commit
51457aa889
|
@ -82,7 +82,7 @@ def inbox_undo_follow(payload, context):
|
||||||
serializer = serializers.UndoFollowSerializer(data=payload, context=context)
|
serializer = serializers.UndoFollowSerializer(data=payload, context=context)
|
||||||
if not serializer.is_valid(raise_exception=context.get("raise_exception", False)):
|
if not serializer.is_valid(raise_exception=context.get("raise_exception", False)):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Discarding invalid follow undo from {}: %s",
|
"Discarding invalid follow undo from %s: %s",
|
||||||
context["actor"].fid,
|
context["actor"].fid,
|
||||||
serializer.errors,
|
serializer.errors,
|
||||||
)
|
)
|
||||||
|
|
|
@ -560,7 +560,7 @@ class LibrarySerializer(PaginatedCollectionSerializer):
|
||||||
r = super().to_representation(conf)
|
r = super().to_representation(conf)
|
||||||
r["audience"] = (
|
r["audience"] = (
|
||||||
"https://www.w3.org/ns/activitystreams#Public"
|
"https://www.w3.org/ns/activitystreams#Public"
|
||||||
if library.privacy_level == "public"
|
if library.privacy_level == "everyone"
|
||||||
else ""
|
else ""
|
||||||
)
|
)
|
||||||
r["followers"] = library.followers_url
|
r["followers"] = library.followers_url
|
||||||
|
|
|
@ -476,7 +476,7 @@ def test_collection_page_serializer(factories):
|
||||||
|
|
||||||
|
|
||||||
def test_music_library_serializer_to_ap(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
|
# pending, errored and skippednot included
|
||||||
factories["music.Upload"](import_status="pending")
|
factories["music.Upload"](import_status="pending")
|
||||||
factories["music.Upload"](import_status="errored")
|
factories["music.Upload"](import_status="errored")
|
||||||
|
@ -488,11 +488,11 @@ def test_music_library_serializer_to_ap(factories):
|
||||||
"https://w3id.org/security/v1",
|
"https://w3id.org/security/v1",
|
||||||
{},
|
{},
|
||||||
],
|
],
|
||||||
|
"audience": "https://www.w3.org/ns/activitystreams#Public",
|
||||||
"type": "Library",
|
"type": "Library",
|
||||||
"id": library.fid,
|
"id": library.fid,
|
||||||
"name": library.name,
|
"name": library.name,
|
||||||
"summary": library.description,
|
"summary": library.description,
|
||||||
"audience": "",
|
|
||||||
"actor": library.actor.fid,
|
"actor": library.actor.fid,
|
||||||
"totalItems": 0,
|
"totalItems": 0,
|
||||||
"current": library.fid + "?page=1",
|
"current": library.fid + "?page=1",
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Advertise public libraries properly in ActivityPub representations (#553)
|
Loading…
Reference in New Issue