diff options
author | Rémy Coutable <remy@rymai.me> | 2016-04-05 18:15:13 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-04-06 16:14:51 +0200 |
commit | e79b867d2b24f97cdf91315abd9dbbb22dc2d0e4 (patch) | |
tree | 5582285801bd633c3b319ec5a6c640ea4e2aff22 /app/models | |
parent | 1749bd3b467b151074cd10f1d11c679fb714854b (diff) | |
download | gitlab-ce-e79b867d2b24f97cdf91315abd9dbbb22dc2d0e4.tar.gz |
Ensure empty recipients are rejected in BuildsEmailService
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/project_services/builds_email_service.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/models/project_services/builds_email_service.rb b/app/models/project_services/builds_email_service.rb index f6313255cbb..f9f04838766 100644 --- a/app/models/project_services/builds_email_service.rb +++ b/app/models/project_services/builds_email_service.rb @@ -50,12 +50,15 @@ class BuildsEmailService < Service def execute(push_data) return unless supported_events.include?(push_data[:object_kind]) + return unless should_build_be_notified?(push_data) - if should_build_be_notified?(push_data) + recipients = all_recipients(push_data) + + if recipients.any? BuildEmailWorker.perform_async( push_data[:build_id], - all_recipients(push_data), - push_data, + recipients, + push_data ) end end @@ -84,7 +87,7 @@ class BuildsEmailService < Service end def all_recipients(data) - all_recipients = recipients.split(',') + all_recipients = recipients.split(',').compact.reject(&:blank?) if add_pusher? && data[:user][:email] all_recipients << "#{data[:user][:email]}" |