From 4ad63c29bb64bbb29598c6eef3b38e8b07c8d9e8 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Tue, 13 Sep 2016 23:38:46 +0800 Subject: [PATCH] Fixed the names and add missing check --- app/models/project_services/pipelines_email_service.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/project_services/pipelines_email_service.rb b/app/models/project_services/pipelines_email_service.rb index 7ce0aa7c16e..5f8d7554057 100644 --- a/app/models/project_services/pipelines_email_service.rb +++ b/app/models/project_services/pipelines_email_service.rb @@ -7,7 +7,7 @@ class PipelinesEmailService < Service if: ->(s) { s.activated? && !s.add_pusher? } def initialize_properties - self.properties ||= { notify_only_broken_builds: true } + self.properties ||= { notify_only_broken_pipelines: true } end def title @@ -28,7 +28,7 @@ class PipelinesEmailService < Service def execute(data, force = false) return unless supported_events.include?(data[:object_kind]) - return unless force || should_build_be_notified?(data) + return unless force || should_pipeline_be_notified?(data) all_recipients = retrieve_recipients(data) @@ -73,10 +73,12 @@ class PipelinesEmailService < Service { success: false, result: error } end - def should_build_be_notified?(data) + def should_pipeline_be_notified?(data) case data[:object_attributes][:status] when 'success' !notify_only_broken_pipelines? + when 'failed' + true else false end