Return the version id in the current_version for add-ons returned from the discovery API (#9858)

Fixes #9855
This commit is contained in:
William Durand 2018-10-31 20:34:30 +01:00 коммит произвёл GitHub
Родитель cd3fe5a490
Коммит 9f5f2f5d76
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 5 добавлений и 2 удалений

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

@ -26,7 +26,7 @@ Firefox (about:addons).
:>json string results[].heading: The heading for this item. May contain some HTML tags.
:>json string|null results[].description: The description for this item, if any. May contain some HTML tags.
:>json boolean results[].is_recommendation: If this item was from the recommendation service, rather than static curated content.
:>json object results[].addon: The :ref:`add-on <addon-detail-object>` for this item. Only a subset of fields are present: ``id``, ``current_version`` (with only the ``compatibility``, ``is_strict_compatibility_enabled`` and ``files`` fields present), ``guid``, ``icon_url``, ``name``, ``previews``, ``slug``, ``theme_data``, ``type`` and ``url``.
:>json object results[].addon: The :ref:`add-on <addon-detail-object>` for this item. Only a subset of fields are present: ``id``, ``current_version`` (with only the ``id``, ``compatibility``, ``is_strict_compatibility_enabled`` and ``files`` fields present), ``guid``, ``icon_url``, ``name``, ``previews``, ``slug``, ``theme_data``, ``type`` and ``url``.
-------------------------

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

@ -287,3 +287,4 @@ v4 API changelog
* 2018-10-18: added ``_score`` to the addons search API.
* 2018-10-25: changed ``author`` parameter on addons search API to accept user ids as well as usernames. This change was also backported to the `v3` API. https://github.com/mozilla/addons-server/issues/8901
* 2018-10-25: added ``fxa_edit_email_url`` parameter on accounts API to return the full URL for editing the user's email on FxA. https://github.com/mozilla/addons-server/issues/8674
* 2018-10-31: added ``id`` to discovery API ``addons.current_version`` object. This change was also backported to the `v3` API. https://github.com/mozilla/addons-server/issues/9855

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

@ -20,7 +20,8 @@ class DiscoveryEditorialContentSerializer(serializers.ModelSerializer):
class DiscoveryVersionSerializer(VersionSerializer):
class Meta:
fields = ('compatibility', 'is_strict_compatibility_enabled', 'files',)
fields = ('id', 'compatibility', 'is_strict_compatibility_enabled',
'files',)
model = Version

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

@ -23,6 +23,7 @@ class DiscoveryTestMixin(object):
assert data['is_strict_compatibility_enabled'] is False
assert data['files']
assert len(data['files']) == 1
assert data['id'] == version.id
result_file = data['files'][0]
file_ = version.files.latest('pk')