mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 00:33:17 +00:00
Implement checking of user notification preferences before send_notification()
This commit is contained in:
parent
6dcb489d6b
commit
7822d49431
1 changed files with 2 additions and 2 deletions
|
|
@ -53,7 +53,7 @@ def send_notification(page_revision_id, notification, excluded_user_id):
|
|||
if notification == 'submitted':
|
||||
# Get list of publishers
|
||||
recipients = users_with_page_permission(revision.page, 'publish')
|
||||
elif notification == 'approved' or notification == 'rejected':
|
||||
elif notification in ['rejected', 'approved']:
|
||||
# Get submitter
|
||||
recipients = [revision.user]
|
||||
else:
|
||||
|
|
@ -62,7 +62,7 @@ def send_notification(page_revision_id, notification, excluded_user_id):
|
|||
# Get list of email addresses
|
||||
email_addresses = [
|
||||
recipient.email for recipient in recipients
|
||||
if recipient.email and recipient.id != excluded_user_id
|
||||
if recipient.email and recipient.id != excluded_user_id and getattr(recipient.get_profile(), notification + '_notifications')
|
||||
]
|
||||
|
||||
# Return if there are no email addresses
|
||||
|
|
|
|||
Loading…
Reference in a new issue