2013-12-17 10:42:40 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: services
|
|
|
|
#
|
2014-10-09 15:22:20 +00:00
|
|
|
# id :integer not null, primary key
|
|
|
|
# type :string(255)
|
|
|
|
# title :string(255)
|
|
|
|
# project_id :integer not null
|
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
|
|
|
# active :boolean default(FALSE), not null
|
|
|
|
# properties :text
|
2013-12-17 10:42:40 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
class EmailsOnPushService < Service
|
2014-09-08 00:54:18 +00:00
|
|
|
prop_accessor :recipients
|
2013-12-17 10:42:40 +00:00
|
|
|
validates :recipients, presence: true, if: :activated?
|
|
|
|
|
|
|
|
def title
|
|
|
|
'Emails on push'
|
|
|
|
end
|
|
|
|
|
|
|
|
def description
|
2013-12-17 14:31:12 +00:00
|
|
|
'Email the commits and diff of each push to a list of recipients.'
|
2013-12-17 10:42:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_param
|
|
|
|
'emails_on_push'
|
|
|
|
end
|
|
|
|
|
2013-12-17 12:45:55 +00:00
|
|
|
def execute(push_data)
|
2013-12-18 11:42:12 +00:00
|
|
|
EmailsOnPushWorker.perform_async(project_id, recipients, push_data)
|
2013-12-17 10:42:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def fields
|
|
|
|
[
|
2013-12-17 10:58:44 +00:00
|
|
|
{ type: 'textarea', name: 'recipients', placeholder: 'Emails separated by whitespace' },
|
2013-12-17 10:42:40 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|