diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/noteable.rb | 2 | ||||
-rw-r--r-- | app/models/notification_recipient.rb | 20 |
2 files changed, 9 insertions, 13 deletions
diff --git a/app/models/concerns/noteable.rb b/app/models/concerns/noteable.rb index 423ce7e7db1..bfd0c36942b 100644 --- a/app/models/concerns/noteable.rb +++ b/app/models/concerns/noteable.rb @@ -13,7 +13,7 @@ module Noteable end end - # The timestamp of the note (e.g. the :updated_at attribute if provided via + # The timestamp of the note (e.g. the :created_at or :updated_at attribute if provided via # API call) def system_note_timestamp @system_note_timestamp || Time.now # rubocop:disable Gitlab/ModuleWithInstanceVariables 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 |