Commit 4ad63c29 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Fixed the names and add missing check

parent 2ccd4c32
...@@ -7,7 +7,7 @@ class PipelinesEmailService < Service ...@@ -7,7 +7,7 @@ class PipelinesEmailService < Service
if: ->(s) { s.activated? && !s.add_pusher? } if: ->(s) { s.activated? && !s.add_pusher? }
def initialize_properties def initialize_properties
self.properties ||= { notify_only_broken_builds: true } self.properties ||= { notify_only_broken_pipelines: true }
end end
def title def title
...@@ -28,7 +28,7 @@ class PipelinesEmailService < Service ...@@ -28,7 +28,7 @@ class PipelinesEmailService < Service
def execute(data, force = false) def execute(data, force = false)
return unless supported_events.include?(data[:object_kind]) 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) all_recipients = retrieve_recipients(data)
...@@ -73,10 +73,12 @@ class PipelinesEmailService < Service ...@@ -73,10 +73,12 @@ class PipelinesEmailService < Service
{ success: false, result: error } { success: false, result: error }
end end
def should_build_be_notified?(data) def should_pipeline_be_notified?(data)
case data[:object_attributes][:status] case data[:object_attributes][:status]
when 'success' when 'success'
!notify_only_broken_pipelines? !notify_only_broken_pipelines?
when 'failed'
true
else else
false false
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment