Reinstate BaseLogEntry.comment property (#7253)

Fixes #7163
pull/7254/head
Matt Westcott 2021-06-14 17:39:46 +01:00 zatwierdzone przez GitHub
rodzic 8422150485
commit 4749c89cc8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -4871,6 +4871,10 @@ class BaseLogEntry(models.Model):
def format_comment(self):
return self.action_registry.format_comment(self)
@property
def comment(self):
return self.format_comment()
class PageLogEntry(BaseLogEntry):
page = models.ForeignKey(

Wyświetl plik

@ -263,7 +263,7 @@ class TestAuditLog(TestCase):
for action in ['approve', 'reject']:
with self.subTest(action):
task_state = workflow_state.current_task_state
task_state.task.on_action(task_state, user=None, action_name=action)
task_state.task.on_action(task_state, user=None, action_name=action, comment="This is my comment")
workflow_state.refresh_from_db()
entry = PageLogEntry.objects.filter(action='wagtail.workflow.{}'.format(action))
@ -283,8 +283,9 @@ class TestAuditLog(TestCase):
'title': workflow_state.current_task_state.task.name,
},
},
'comment': '',
'comment': 'This is my comment',
})
self.assertEqual(entry[0].comment, "This is my comment")
def test_workflow_completions_logs_publishing_user(self):
workflow = Workflow.objects.create(name='test_workflow')