Merge branch '170-channel-icon' into 'develop'
See #170: include proper icon in channel actor representation See merge request funkwhale/funkwhale!1032
This commit is contained in:
commit
20863eb9bc
|
@ -208,6 +208,7 @@ class ActorSerializer(jsonld.JsonLdSerializer):
|
|||
"mediaType": "application/rss+xml",
|
||||
},
|
||||
]
|
||||
include_image(ret, channel.artist.attachment_cover, "icon")
|
||||
else:
|
||||
ret["url"] = [
|
||||
{
|
||||
|
@ -216,6 +217,7 @@ class ActorSerializer(jsonld.JsonLdSerializer):
|
|||
"mediaType": "text/html",
|
||||
}
|
||||
]
|
||||
include_image(ret, instance.attachment_icon, "icon")
|
||||
|
||||
ret["@context"] = jsonld.get_default_context()
|
||||
if instance.public_key:
|
||||
|
@ -226,8 +228,6 @@ class ActorSerializer(jsonld.JsonLdSerializer):
|
|||
}
|
||||
ret["endpoints"] = {}
|
||||
|
||||
include_image(ret, instance.attachment_icon, "icon")
|
||||
|
||||
if instance.shared_inbox_url:
|
||||
ret["endpoints"]["sharedInbox"] = instance.shared_inbox_url
|
||||
return ret
|
||||
|
|
|
@ -1210,7 +1210,8 @@ def test_track_serializer_update_license(factories):
|
|||
|
||||
|
||||
def test_channel_actor_serializer(factories):
|
||||
channel = factories["audio.Channel"]()
|
||||
channel = factories["audio.Channel"](actor__attachment_icon=None)
|
||||
|
||||
serializer = serializers.ActorSerializer(channel.actor)
|
||||
expected_url = [
|
||||
{
|
||||
|
@ -1224,8 +1225,13 @@ def test_channel_actor_serializer(factories):
|
|||
"mediaType": "application/rss+xml",
|
||||
},
|
||||
]
|
||||
|
||||
expected_icon = {
|
||||
"type": "Image",
|
||||
"mediaType": channel.artist.attachment_cover.mimetype,
|
||||
"url": channel.artist.attachment_cover.download_url_original,
|
||||
}
|
||||
assert serializer.data["url"] == expected_url
|
||||
assert serializer.data["icon"] == expected_icon
|
||||
|
||||
|
||||
def test_channel_actor_outbox_serializer(factories):
|
||||
|
|
Loading…
Reference in New Issue