Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Derichs <pderichs@gitlab.com>2019-04-17 12:10:42 +0300
committerSean McGivern <sean@gitlab.com>2019-04-17 12:10:42 +0300
commit5dad9a306a32f8f5d47d22760a16f7864f85054c (patch)
tree24a9cb374c3548664b0deeaafb45e80b91800106 /app/models/notification_recipient.rb
parent2c5398ee96799440523a03c7c770e90a9629762a (diff)
Fix unexpected extra notification mails
Using custom_action and recipient filtering Add more generic filtering to user_ids_notifiable_on Add changelog entry Remove commented class Method is no longer needed Overloading no longer required Filter by action just in case of custom notification level Add participant check Fix unexpected extra notification mails Using custom_action and recipient filtering Add more generic filtering to user_ids_notifiable_on Add changelog entry Remove commented class Method is no longer needed Overloading no longer required Filter by action just in case of custom notification level Fix comment Add repond_to? checks Reverted custom_action filtering Enhanced output of should_email helper Changed :watch to :participating for custom notifiable users Change spec variable name Enhanced participating check These conditions are no longer needed Fix custom notification handling for participating type Participating level should include maintainers Fixed add_guest notification Fix successful pipeline notification Refactoring: Use maintainer? method on team instead Add spec for new_issue: true for a custom group setting which should have lower prio than an available project setting Clean up specs
Diffstat (limited to 'app/models/notification_recipient.rb')
-rw-r--r--app/models/notification_recipient.rb20
1 files changed, 8 insertions, 12 deletions
diff --git a/app/models/notification_recipient.rb b/app/models/notification_recipient.rb
index 793cce191fa..377ac3febb6 100644
--- a/app/models/notification_recipient.rb
+++ b/app/models/notification_recipient.rb
@@ -47,14 +47,14 @@ class NotificationRecipient
def suitable_notification_level?
case notification_level
- when :disabled, nil
- false
- when :custom
- custom_enabled? || %i[participating mention].include?(@type)
- when :watch, :participating
- !action_excluded?
when :mention
@type == :mention
+ when :participating
+ !excluded_participating_action? && %i[participating mention watch].include?(@type)
+ when :custom
+ custom_enabled? || %i[participating mention].include?(@type)
+ when :watch
+ !excluded_watcher_action?
else
false
end
@@ -100,18 +100,14 @@ class NotificationRecipient
end
end
- def action_excluded?
- excluded_watcher_action? || excluded_participating_action?
- end
-
def excluded_watcher_action?
- return false unless @custom_action && notification_level == :watch
+ return false unless @custom_action
NotificationSetting::EXCLUDED_WATCHER_EVENTS.include?(@custom_action)
end
def excluded_participating_action?
- return false unless @custom_action && notification_level == :participating
+ return false unless @custom_action
NotificationSetting::EXCLUDED_PARTICIPATING_EVENTS.include?(@custom_action)
end