Introduce EXCLUDED_WATCHER_EVENTS to exclude events

for watchers. Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8176#note_20920905
This commit is contained in:
Lin Jen-Shin 2017-01-05 19:31:11 +08:00
parent 365cdd8fe0
commit ce7c632f50
2 changed files with 5 additions and 2 deletions

View File

@ -37,6 +37,10 @@ class NotificationSetting < ActiveRecord::Base
:success_pipeline
]
EXCLUDED_WATCHER_EVENTS = [
:success_pipeline
]
store :events, accessors: EMAIL_EVENTS, coder: JSON
before_create :set_events

View File

@ -592,8 +592,7 @@ class NotificationService
recipients = target.participants(current_user)
# TODO: CLEAN ME UP!
unless custom_action == :success_pipeline
unless NotificationSetting::EXCLUDED_WATCHER_EVENTS.include?(custom_action)
recipients = add_project_watchers(recipients, project)
end