Check if notification policies is empty

This commit is contained in:
Michael Derynck 2022-08-30 15:26:04 -06:00
parent 15c2070898
commit c26158ba9d

View file

@ -62,12 +62,14 @@ def notify_group_task(alert_group_pk, escalation_policy_snapshot_order=None):
user=user,
important=escalation_policy_step == EscalationPolicy.STEP_NOTIFY_GROUP_IMPORTANT,
)
usergroup_notification_plan += "\n_{} (".format(
step.get_user_notification_message_for_thread_for_usergroup(user, notification_policies.first())
)
notification_channels = []
if notification_policies.filter(step=UserNotificationPolicy.Step.NOTIFY).count() == 0:
usergroup_notification_plan += "Empty notifications"
else:
usergroup_notification_plan += "\n_{} (".format(
step.get_user_notification_message_for_thread_for_usergroup(user, notification_policies.first())
)
for notification_policy in notification_policies:
if notification_policy.step == UserNotificationPolicy.Step.NOTIFY:
notification_channels.append(