Remove pusher support because it's covered by notifications

This commit is contained in:
Lin Jen-Shin 2016-09-14 21:43:52 +08:00
parent f049bdeb9d
commit 9c2d40649e
2 changed files with 2 additions and 20 deletions

View file

@ -1,10 +1,9 @@
class PipelinesEmailService < Service class PipelinesEmailService < Service
prop_accessor :recipients prop_accessor :recipients
boolean_accessor :add_pusher
boolean_accessor :notify_only_broken_pipelines boolean_accessor :notify_only_broken_pipelines
validates :recipients, validates :recipients,
presence: true, presence: true,
if: ->(s) { s.activated? && !s.add_pusher? } if: ->(s) { s.activated? }
def initialize_properties def initialize_properties
self.properties ||= { notify_only_broken_pipelines: true } self.properties ||= { notify_only_broken_pipelines: true }
@ -57,9 +56,6 @@ class PipelinesEmailService < Service
{ type: 'textarea', { type: 'textarea',
name: 'recipients', name: 'recipients',
placeholder: 'Emails separated by comma' }, placeholder: 'Emails separated by comma' },
{ type: 'checkbox',
name: 'add_pusher',
label: 'Add pusher to recipients list' },
{ type: 'checkbox', { type: 'checkbox',
name: 'notify_only_broken_pipelines' }, name: 'notify_only_broken_pipelines' },
] ]
@ -85,12 +81,6 @@ class PipelinesEmailService < Service
end end
def retrieve_recipients(data) def retrieve_recipients(data)
all_recipients = recipients.to_s.split(',').reject(&:blank?) recipients.to_s.split(',').reject(&:blank?)
if add_pusher? && data[:user].try(:[], :email)
all_recipients << data[:user][:email]
end
all_recipients
end end
end end

View file

@ -23,14 +23,6 @@ describe PipelinesEmailService do
end end
it { is_expected.to validate_presence_of(:recipients) } it { is_expected.to validate_presence_of(:recipients) }
context 'when pusher is added' do
before do
subject.add_pusher = true
end
it { is_expected.not_to validate_presence_of(:recipients) }
end
end end
context 'when service is inactive' do context 'when service is inactive' do