diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b1cf1ab2c6..c1ea9271da 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -24,6 +24,7 @@ Changelog * Fix: Image uploader now accepts JPEG images that PIL reports as being in MPO format * Fix: Multiple checkbox fields on form-builder forms did not correctly save multiple values * Fix: Editing a page's slug and saving it without publishing could sometimes cause the URL paths of child pages to be corrupted + * Fix: 'latest_revision_created_at' was being cleared on page publish, causing the page to drop to the bottom of explorer listings 0.7 (09.10.2014) ~~~~~~~~~~~~~~~~ diff --git a/docs/releases/0.8.rst b/docs/releases/0.8.rst index a817791ba4..d6c28a862c 100644 --- a/docs/releases/0.8.rst +++ b/docs/releases/0.8.rst @@ -40,6 +40,8 @@ Bug fixes * Image uploader now accepts JPEG images that PIL reports as being in MPO format * Multiple checkbox fields on form-builder forms did not correctly save multiple values * Editing a page's slug and saving it without publishing could sometimes cause the URL paths of child pages to be corrupted + * ``latest_revision_created_at`` was being cleared on page publish, causing the page to drop to the bottom of explorer listings + Upgrade considerations ====================== diff --git a/wagtail/wagtailcore/models.py b/wagtail/wagtailcore/models.py index 801a35534a..1be21797c2 100644 --- a/wagtail/wagtailcore/models.py +++ b/wagtail/wagtailcore/models.py @@ -1037,6 +1037,7 @@ class PageRevision(models.Model): obj.has_unpublished_changes = self.page.has_unpublished_changes obj.owner = self.page.owner obj.locked = self.page.locked + obj.latest_revision_created_at = self.page.latest_revision_created_at return obj diff --git a/wagtail/wagtailcore/tests/test_page_model.py b/wagtail/wagtailcore/tests/test_page_model.py index 8e767c730d..8e049129b4 100644 --- a/wagtail/wagtailcore/tests/test_page_model.py +++ b/wagtail/wagtailcore/tests/test_page_model.py @@ -620,3 +620,22 @@ class TestIssue735(TestCase): # Check that the christmas events url path updated correctly new_christmas_event = EventPage.objects.get(id=christmas_event.id) self.assertEqual(new_christmas_event.url_path, '/home/old-events/christmas/') + + +class TestIssue756(TestCase): + """ + Issue 756 reports that the latest_revision_created_at + field was getting clobbered whenever a revision was published + """ + def test_publish_revision_doesnt_remove_latest_revision_created_at(self): + # Create a revision + revision = Page.objects.get(id=1).save_revision() + + # Check that latest_revision_created_at is set + self.assertIsNotNone(Page.objects.get(id=1).latest_revision_created_at) + + # Publish the revision + revision.publish() + + # Check that latest_revision_created_at is still set + self.assertIsNotNone(Page.objects.get(id=1).latest_revision_created_at)