Commit 2c695c80 authored by charlie ablett's avatar charlie ablett

Handle multiple owners in disabled worker notifier

parent 99be341f
......@@ -32,8 +32,12 @@ module AutoDevops
def email_receivers_for(pipeline, project)
recipients = [pipeline.user&.email]
recipients << project.owner.email unless project.group
recipients.uniq.compact
if project.personal?
recipients << project.owners.map(&:email)
end
recipients.flatten.uniq.compact
end
end
end
......@@ -26,7 +26,7 @@ RSpec.describe AutoDevops::DisableWorker, '#perform' do
let(:namespace) { create(:namespace, owner: owner) }
let(:project) { create(:project, :repository, :auto_devops, namespace: namespace) }
it 'sends an email to pipeline user and project owner' do
it 'sends an email to pipeline user and project owner(s)' do
expect(NotificationService).to receive_message_chain(:new, :autodevops_disabled).with(pipeline, [user.email, owner.email])
subject.perform(pipeline.id)
......
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