Skip to content

Commit

Permalink
Label edit actions as 'Edited' instead of 'Draft saved' for non Page …
Browse files Browse the repository at this point in the history
…models

Fixes #7622
  • Loading branch information
gasman committed Oct 22, 2021
1 parent 73f65e9 commit b6b6809
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/extending/audit_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ Log actions provided by Wagtail
=================================== =====
Action Notes
=================================== =====
``wagtail.create`` The page was created
``wagtail.edit`` A draft was saved
``wagtail.delete`` The page was deleted. Will only surface in the Site History for administrators
``wagtail.create`` The object was created
``wagtail.edit`` The object was edited (for pages, saved as draft)
``wagtail.delete`` The object was deleted. Will only surface in the Site History for administrators
``wagtail.publish`` The page was published
``wagtail.publish.schedule`` Draft is scheduled for publishing
``wagtail.publish.scheduled`` Draft published via ``publish_scheduled_pages`` management command
Expand Down
8 changes: 8 additions & 0 deletions wagtail/core/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4063,6 +4063,14 @@ def __str__(self):
def object_id(self):
return self.page_id

@cached_property
def message(self):
# for page log entries, the 'edit' action should show as 'Draft saved'
if self.action == 'wagtail.edit':
return _("Draft saved")
else:
return super().message


class Comment(ClusterableModel):
"""
Expand Down
2 changes: 1 addition & 1 deletion wagtail/core/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def register_core_log_actions(actions):
actions.register_model(Page, PageLogEntry)

actions.register_action('wagtail.create', _('Create'), _('Created'))
actions.register_action('wagtail.edit', _('Save draft'), _('Draft saved'))
actions.register_action('wagtail.edit', _('Edit'), _('Edited'))
actions.register_action('wagtail.delete', _('Delete'), _('Deleted'))
actions.register_action('wagtail.publish', _('Publish'), _('Published'))
actions.register_action('wagtail.publish.scheduled', _("Publish scheduled draft"), _('Published scheduled draft'))
Expand Down

0 comments on commit b6b6809

Please sign in to comment.