kopia lustrzana https://github.com/wagtail/wagtail
Fix incorrect logging of move VS reorder
rodzic
e602990e39
commit
0086c7ba7a
wagtail/core
models
tests
|
@ -1546,7 +1546,7 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
|
|||
log_entry = log(
|
||||
instance=self,
|
||||
# Check if page was reordered (reordering doesn't change the parent)
|
||||
action='wagtail.move' if url_path_changed else 'wagtail.reorder',
|
||||
action='wagtail.move' if parent_before.id != parent_after.id else 'wagtail.reorder',
|
||||
user=user,
|
||||
data={
|
||||
'source': {
|
||||
|
|
|
@ -209,7 +209,10 @@ class TestAuditLog(TestCase):
|
|||
instance=SimplePage(title="About us", slug="about", content="hello")
|
||||
)
|
||||
user = get_user_model().objects.first()
|
||||
section.move(self.home_page, user=user)
|
||||
# move() interprets `target` as an intended 'sibling' by default, so
|
||||
# we must use `pos` to indicate that `self.home_page` should be the
|
||||
# new 'parent'
|
||||
section.move(self.home_page, pos="last-child", user=user)
|
||||
|
||||
self.assertEqual(PageLogEntry.objects.filter(action='wagtail.move', user=user).count(), 1)
|
||||
self.assertEqual(PageLogEntry.objects.filter(action='wagtail.reorder', user=user).count(), 0)
|
||||
|
|
Ładowanie…
Reference in New Issue