summaryrefslogtreecommitdiff
path: root/app/services/ci/send_pipeline_notification_service.rb
blob: ceb182801f7f5a788acb0ac475172897578b0a62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Ci
  class SendPipelineNotificationService
    attr_reader :pipeline

    def initialize(new_pipeline)
      @pipeline = new_pipeline
    end

    def execute(recipients)
      email_template = "pipeline_#{pipeline.status}_email"

      return unless Notify.respond_to?(email_template)

      recipients.each do |to|
        Notify.public_send(email_template, pipeline, to).deliver_later
      end
    end
  end
end