Skip to content
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

Change stable version switching to respect active #3336

Merged
merged 2 commits into from
Nov 30, 2017
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
2 changes: 1 addition & 1 deletion readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ def update_stable_version(self):
if current_stable:
identifier_updated = (
new_stable.identifier != current_stable.identifier)
if identifier_updated and current_stable.machine:
if identifier_updated and current_stable.active:
log.info(
"Update stable version: {project}:{version}".format(
project=self.slug,
Expand Down
1 change: 0 additions & 1 deletion readthedocs/projects/views/private.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ def project_version_detail(request, project_slug, version_slug):
log.info('Removing files for version %s', version.slug)
broadcast(type='app', task=tasks.clear_artifacts, args=[version.pk])
version.built = False
version.machine = False
version.save()
url = reverse('project_version_list', args=[project.slug])
return HttpResponseRedirect(url)
Expand Down
5 changes: 4 additions & 1 deletion readthedocs/rtd_tests/tests/test_sync_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ def test_update_stable_version(self):
self.assertEqual(version_stable.identifier, '1.0.0')

def test_update_inactive_stable_version(self):
"""
Test that stable doesn't get updated when it isn't active
"""
version_post_data = {
'branches': [
{
Expand Down Expand Up @@ -388,7 +391,7 @@ def test_update_inactive_stable_version(self):

version_stable = Version.objects.get(slug=STABLE)
self.assertFalse(version_stable.active)
self.assertEqual(version_stable.identifier, '1.0.0')
self.assertEqual(version_stable.identifier, '0.9')

def test_stable_version_tags_over_branches(self):
version_post_data = {
Expand Down