Verified Commit de7713f3 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

See #170: include proper icon in channel actor representation

parent 4bc11cc5
......@@ -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):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment