0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 01:46:24 +01:00

Exclude triggering user from notification email at final queryset step to avoid readding

This commit is contained in:
jacobtm 2020-01-10 10:46:26 +00:00 committed by Matt Westcott
parent a66d88d708
commit 12a8446038

View File

@ -124,10 +124,11 @@ def send_group_approval_task_state_notification(task_state, notification, trigge
if requested_by != triggering_user:
recipients = [triggering_user]
elif notification == 'submitted':
recipients = task_state.task.specific.group.user_set.exclude(pk=triggering_user.pk)
recipients = task_state.task.specific.group.user_set
include_superusers = getattr(settings, 'WAGTAILADMIN_NOTIFICATION_INCLUDE_SUPERUSERS', True)
if include_superusers:
recipients = recipients | get_user_model().objects.filter(is_superuser=True)
recipients = recipients.exclude(pk=triggering_user.pk).distinct()
context = {
"page": page,
"settings": settings,