Simplify handling of empty heading in discovery pane API

Just fall back to the addon name, don't include the author, it will
be part of the theme name already for some themes, that's how their
owner set it up.
This commit is contained in:
Mathieu Pillard 2016-05-20 13:33:43 +02:00
Родитель 37b426a869
Коммит 174635cefa
2 изменённых файлов: 3 добавлений и 10 удалений

Просмотреть файл

@ -28,10 +28,5 @@ class DiscoverySerializer(serializers.Serializer):
def to_representation(self, instance):
data = super(DiscoverySerializer, self).to_representation(instance)
if data['heading'] is None:
if instance.addon.listed_authors:
data['heading'] = u'%s by %s' % (
unicode(instance.addon.name),
instance.addon.listed_authors[0].name)
else:
data['heading'] = unicode(instance.addon.name)
data['heading'] = unicode(instance.addon.name)
return data

Просмотреть файл

@ -38,8 +38,6 @@ class TestDiscoveryViewList(TestCase):
if item.heading:
assert result['heading'] == item.heading
else:
assert result['heading'] == u'%s by %s' % (
unicode(addons[item.addon_id].name),
addons[item.addon_id].listed_authors[0].name)
assert result['heading'] == unicode(addons[item.addon_id].name)
assert result['description'] == item.description
assert result['current_version']
assert result['addon']['current_version']