From ed7a4d9e78845c72939f585f451757935834eecd Mon Sep 17 00:00:00 2001 From: Patrick Derichs Date: Tue, 16 Apr 2019 14:14:57 +0200 Subject: Testing level / type relationship for notifications --- app/models/notification_recipient.rb | 6 +----- app/services/notification_service.rb | 2 +- 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) -- cgit v1.2.1