summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Derichs <pderichs@gitlab.com>2019-04-16 14:14:57 +0200
committerPatrick Derichs <pderichs@gitlab.com>2019-04-16 14:15:16 +0200
commited7a4d9e78845c72939f585f451757935834eecd (patch)
treef0070a774706f28c31db691092def147cbda7b9c
parent47f4990d8f993b299944d122200339ae381950b5 (diff)
downloadgitlab-ce-pderichs-email-notifications-test.tar.gz
Testing level / type relationship for notificationspderichs-email-notifications-test
-rw-r--r--app/models/notification_recipient.rb6
-rw-r--r--app/services/notification_service.rb2
2 files changed, 2 insertions, 6 deletions
diff --git a/app/models/notification_recipient.rb b/app/models/notification_recipient.rb
index 377ac3febb6..70838138042 100644
--- a/app/models/notification_recipient.rb
+++ b/app/models/notification_recipient.rb
@@ -5,10 +5,6 @@ class NotificationRecipient
attr_reader :user, :type, :reason
def initialize(user, type, **opts)
- unless NotificationSetting.levels.key?(type) || type == :subscription
- raise ArgumentError, "invalid type: #{type.inspect}"
- end
-
@custom_action = opts[:custom_action]
@acting_user = opts[:acting_user]
@target = opts[:target]
@@ -50,7 +46,7 @@ class NotificationRecipient
when :mention
@type == :mention
when :participating
- !excluded_participating_action? && %i[participating mention watch].include?(@type)
+ !excluded_participating_action? && %i[participating mention pipeline].include?(@type)
when :custom
custom_enabled? || %i[participating mention].include?(@type)
when :watch
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 8d3b569498f..1e39d55539c 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -415,7 +415,7 @@ class NotificationService
return unless mailer.respond_to?(email_template)
recipients ||= notifiable_users(
- [pipeline.user], :watch,
+ [pipeline.user], :pipeline,
custom_action: :"#{pipeline.status}_pipeline",
target: pipeline
).map(&:notification_email)