Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label edit actions as 'Edited' instead of 'Draft saved' for non Page models #7639

Merged
merged 1 commit into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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