feat(api): Add codeOfConduct to NodeInfo Endpoint
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2641>
This commit is contained in:
parent
b6190540ee
commit
3db367f4bc
|
@ -205,6 +205,14 @@ class Metadata21Serializer(MetadataSerializer):
|
||||||
location = serializers.CharField()
|
location = serializers.CharField()
|
||||||
content = MetadataContentSerializer()
|
content = MetadataContentSerializer()
|
||||||
features = serializers.ListField(child=serializers.CharField())
|
features = serializers.ListField(child=serializers.CharField())
|
||||||
|
codeOfConduct = serializers.SerializerMethodField()
|
||||||
|
|
||||||
|
def get_codeOfConduct(self, obj) -> str:
|
||||||
|
return (
|
||||||
|
full_url("/about/pod#rules")
|
||||||
|
if obj["preferences"].get("instance__rules")
|
||||||
|
else ""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class NodeInfo20Serializer(serializers.Serializer):
|
class NodeInfo20Serializer(serializers.Serializer):
|
||||||
|
|
|
@ -155,6 +155,7 @@ def test_nodeinfo_21(api_client):
|
||||||
("topPodcastCategories", []),
|
("topPodcastCategories", []),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
"codeOfConduct": "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue