diff options
author | Sean McGivern <sean@gitlab.com> | 2019-06-06 07:51:33 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-06-06 07:51:33 +0000 |
commit | 3fd99b4e7a58843943ade87a3658d477278aa412 (patch) | |
tree | 467ca165f2273a8e3635fdd0281aa0e8c2ec262e | |
parent | 4fffd0ef5bfbe2152be5dd1bce6786f5f382c5f2 (diff) | |
parent | a1684d1440c7a875ded0d8616e83932aa64f7b4d (diff) | |
download | gitlab-ce-3fd99b4e7a58843943ade87a3658d477278aa412.tar.gz |
Merge branch 'simplify-pipeline-notification-check' into 'master'
Simplify notification check for participating
See merge request gitlab-org/gitlab-ce!29188
-rw-r--r-- | app/models/notification_recipient.rb | 8 | ||||
-rw-r--r-- | app/models/notification_setting.rb | 9 |
2 files changed, 4 insertions, 13 deletions
diff --git a/app/models/notification_recipient.rb b/app/models/notification_recipient.rb index 6f057f79ef6..9b2bbb7eba5 100644 --- a/app/models/notification_recipient.rb +++ b/app/models/notification_recipient.rb @@ -50,7 +50,7 @@ class NotificationRecipient when :mention @type == :mention when :participating - !excluded_participating_action? && %i[participating mention watch].include?(@type) + @custom_action == :failed_pipeline || %i[participating mention].include?(@type) when :custom custom_enabled? || %i[participating mention].include?(@type) when :watch @@ -106,12 +106,6 @@ class NotificationRecipient NotificationSetting::EXCLUDED_WATCHER_EVENTS.include?(@custom_action) end - def excluded_participating_action? - return false unless @custom_action - - NotificationSetting::EXCLUDED_PARTICIPATING_EVENTS.include?(@custom_action) - end - private def read_ability diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb index 61af5c09ae4..8306b11a7b6 100644 --- a/app/models/notification_setting.rb +++ b/app/models/notification_setting.rb @@ -54,14 +54,11 @@ class NotificationSetting < ApplicationRecord self.class.email_events(source) end - EXCLUDED_PARTICIPATING_EVENTS = [ - :success_pipeline - ].freeze - EXCLUDED_WATCHER_EVENTS = [ :push_to_merge_request, - :issue_due - ].push(*EXCLUDED_PARTICIPATING_EVENTS).freeze + :issue_due, + :success_pipeline + ].freeze def self.find_or_create_for(source) setting = find_or_initialize_by(source: source) |