From 02b13fd4ae2764e187f189b25d1725ffca66cdcf Mon Sep 17 00:00:00 2001 From: beeankha Date: Mon, 7 Oct 2019 15:34:09 -0400 Subject: [PATCH] Enable notifications to send at org level, ... ... and list the URL in body of approval notification messages. --- awx/main/models/workflow.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/awx/main/models/workflow.py b/awx/main/models/workflow.py index e85e531aaf..56f5cfd579 100644 --- a/awx/main/models/workflow.py +++ b/awx/main/models/workflow.py @@ -452,6 +452,12 @@ class WorkflowJobTemplate(UnifiedJobTemplate, WorkflowJobOptions, SurveyJobTempl .filter(workflowjobtemplate_notification_templates_for_approvals__in=[self])) # Get Organization NotificationTemplates if self.organization is not None: + error_notification_templates = set(error_notification_templates + list(base_notification_templates.filter( + organization_notification_templates_for_errors=self.organization))) + started_notification_templates = set(started_notification_templates + list(base_notification_templates.filter( + organization_notification_templates_for_started=self.organization))) + success_notification_templates = set(success_notification_templates + list(base_notification_templates.filter( + organization_notification_templates_for_success=self.organization))) approval_notification_templates = set(approval_notification_templates + list(base_notification_templates.filter( organization_notification_templates_for_approvals=self.organization))) return dict(error=list(error_notification_templates), @@ -697,6 +703,9 @@ class WorkflowApproval(UnifiedJob, JobNotificationMixin): def event_class(self): return None + def get_ui_url(self): + return urljoin(settings.TOWER_URL_BASE, '/#/workflows/{}'.format(self.workflow_job.id)) + def _get_parent_field_name(self): return 'workflow_approval_template'