Skip to content

Commit ccbcc7b

Browse files
authored
Use build.version_name first, in case build.version is None (#272)
* Use build.version_name first, in case build.version is None When versions are removed, the builds remain with a `build.version = None`, along with some additional attributes on the Build instance (for example `build.version_name`). This bug affected any display that listed projects/versions that listed the most recent build. Fixes readthedocs/readthedocs.org#11061 * Use get_version_name method instead of template logic
1 parent abc8987 commit ccbcc7b

File tree

1 file changed

+11
-3
lines changed
  • readthedocsext/theme/templates/includes/elements/chips

1 file changed

+11
-3
lines changed

readthedocsext/theme/templates/includes/elements/chips/build.html

+11-3
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,24 @@
1313
{% endblock chip_icon %}
1414

1515
{% block chip_text %}
16-
{# Allow for override of the text for version listing, where version is already stated #}
17-
{{ text|default:build.version.verbose_name }}
16+
{% comment %}
17+
Allow for override of the text for version listing, where version is
18+
already stated. Also use build method to get version name, in case version
19+
instance was deleted at some point. The version name is stored on the build
20+
in this scenario.
21+
{% endcomment %}
22+
{% firstof text build.get_version_name %}
1823
{% endblock chip_text %}
1924

2025
{% block chip_detail_text %}
2126
#{{ build.id }}
2227
{% endblock chip_detail_text %}
2328

2429
{% block popupcard_header %}
25-
{{ text|default:build.version.verbose_name }} #{{ build.id }}
30+
{% comment %}
31+
This block is the same as the chip_text block above.
32+
{% endcomment %}
33+
{% firstof text build.get_version_name %} #{{ build.id }}
2634
{% endblock popupcard_header %}
2735

2836
{% block popupcard_right %}

0 commit comments

Comments
 (0)