Skip to content

Commit

Permalink
Merge pull request #5421 from stsewd/always-update-stable
Browse files Browse the repository at this point in the history
Always update the commit of the stable version
  • Loading branch information
stsewd committed Mar 18, 2019
2 parents 4291265 + b0ffef4 commit 494afdf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ def update_stable_version(self):
identifier_updated = (
new_stable.identifier != current_stable.identifier
)
if identifier_updated and current_stable.active and current_stable.machine:
if identifier_updated and current_stable.machine:
log.info(
'Update stable version: {project}:{version}'.format(
project=self.slug,
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/restapi/views/model_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ def sync_versions(self, request, **kwargs): # noqa: D205
)

promoted_version = project.update_stable_version()
if promoted_version:
new_stable = project.get_stable_version()
new_stable = project.get_stable_version()
if promoted_version and new_stable and new_stable.active:
log.info(
'Triggering new stable build: {project}:{version}'.format(
project=project.slug,
Expand Down
4 changes: 3 additions & 1 deletion readthedocs/rtd_tests/tests/test_sync_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,9 +967,11 @@ def test_update_inactive_stable_version(self):
content_type='application/json',
)

# The identifier of stable is updated
# but the version is still not active
version_stable = Version.objects.get(slug=STABLE)
self.assertFalse(version_stable.active)
self.assertEqual(version_stable.identifier, '0.9')
self.assertEqual(version_stable.identifier, '1.0.0')

def test_stable_version_tags_over_branches(self):
version_post_data = {
Expand Down

0 comments on commit 494afdf

Please sign in to comment.