Skip to content

Do not show wipe version message on build details page for External versions #6034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions readthedocs/builds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ def identifier_friendly(self):
def is_editable(self):
return self.type == BRANCH

@property
def supports_wipe(self):
"""Return True if version is not external."""
return not self.type == EXTERNAL

def get_subdomain_url(self):
private = self.privacy_level == PRIVATE
return self.project.get_docs_url(
Expand Down
6 changes: 6 additions & 0 deletions readthedocs/rtd_tests/tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,9 @@ def test_commit_name_for_latest_version(self):

def test_commit_name_for_external_version(self):
self.assertEqual(self.external_version.commit_name, self.external_version.identifier)

def test_version_does_not_support_wipe(self):
self.assertFalse(self.external_version.supports_wipe)

def test_version_supports_wipe(self):
self.assertTrue(self.branch_version.supports_wipe)
2 changes: 1 addition & 1 deletion readthedocs/templates/builds/build_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
</div>

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