Fixes broken channel page

This commit is contained in:
Marcos 2022-03-22 16:13:19 +01:00 committed by Georg Krause
commit ffd1ae0c44
No known key found for this signature in database
GPG key ID: 2970D504B2183D22
12 changed files with 46 additions and 22 deletions

View file

@ -267,7 +267,7 @@ class ChannelSerializer(serializers.ModelSerializer):
return obj.actor.received_follows.exclude(approved=False).count()
def get_downloads_count(self, obj):
return getattr(obj, "_downloads_count", None)
return getattr(obj, "_downloads_count", None) or 0
def get_actor(self, obj):
if obj.attributed_to == actors.get_service_actor():

View file

@ -250,7 +250,7 @@ def test_channel_serializer_external_representation(factories, to_api_date):
"metadata": {},
"rss_url": channel.get_rss_url(),
"url": channel.actor.url,
"downloads_count": None,
"downloads_count": 0,
}
expected["artist"]["description"] = common_serializers.ContentSerializer(
content