Resolve "NodeInfo 2.0 endpoint returns incorrect type for field `metadatalibrary`" NOCHANGELOG

This commit is contained in:
Georg Krause 2022-11-15 09:33:11 +00:00 committed by JuniorJPDJ
parent c3431c6a63
commit cfabb6fa3e
1 changed files with 2 additions and 1 deletions

View File

@ -137,7 +137,8 @@ class MetadataSerializer(serializers.Serializer):
def get_defaultUploadQuota(self, obj) -> int:
return obj["preferences"].get("users__upload_quota")
def get_library(self, obj) -> bool:
@extend_schema_field(NodeInfoLibrarySerializer)
def get_library(self, obj):
data = obj["stats"] or {}
data["federationEnabled"] = obj["preferences"].get("federation__enabled")
data["anonymousCanListen"] = not obj["preferences"].get(