Skip to content

Commit c051b16

Browse files
authored
Merge pull request #6034 from saadmk11/update-build-details
Do not show wipe version message on build details page for External versions
2 parents 6767b16 + 11dc77a commit c051b16

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

readthedocs/builds/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,11 @@ def identifier_friendly(self):
341341
def is_editable(self):
342342
return self.type == BRANCH
343343

344+
@property
345+
def supports_wipe(self):
346+
"""Return True if version is not external."""
347+
return not self.type == EXTERNAL
348+
344349
def get_subdomain_url(self):
345350
private = self.privacy_level == PRIVATE
346351
return self.project.get_docs_url(

readthedocs/rtd_tests/tests/test_version.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,9 @@ def test_commit_name_for_latest_version(self):
6666

6767
def test_commit_name_for_external_version(self):
6868
self.assertEqual(self.external_version.commit_name, self.external_version.identifier)
69+
70+
def test_version_does_not_support_wipe(self):
71+
self.assertFalse(self.external_version.supports_wipe)
72+
73+
def test_version_supports_wipe(self):
74+
self.assertTrue(self.branch_version.supports_wipe)

readthedocs/templates/builds/build_detail.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
</div>
123123

124124
{% if request.user|is_admin:project %}
125-
{% if not build.success and build.commands.count < 4 %}
125+
{% if not build.success and build.commands.count < 4 and build.version.supports_wipe %}
126126
<div class="build-ideas">
127127
<p>
128128
{% url 'wipe_version' build.version.project.slug build.version.slug as wipe_url %}

0 commit comments

Comments
 (0)