diff --git a/app/workers/auto_devops/disable_worker.rb b/app/workers/auto_devops/disable_worker.rb index 9ec3e5490c220efd7e2da7fbd889a1c093875ea8..03613db3f29b4a2014c6b3cd5d5592513051e832 100644 --- a/app/workers/auto_devops/disable_worker.rb +++ b/app/workers/auto_devops/disable_worker.rb @@ -32,8 +32,12 @@ def send_notification_email(pipeline, project) 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 diff --git a/spec/workers/auto_devops/disable_worker_spec.rb b/spec/workers/auto_devops/disable_worker_spec.rb index 239f4b09f5ce5a848c00de04d4f902bf5f63748e..e1de97e0ce5119c98eda5594a7887a4f98b6f901 100644 --- a/spec/workers/auto_devops/disable_worker_spec.rb +++ b/spec/workers/auto_devops/disable_worker_spec.rb @@ -26,7 +26,7 @@ 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)