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:
authorStan Hu <stanhu@gmail.com>2017-06-23 00:45:49 +0300
committerStan Hu <stanhu@gmail.com>2017-06-23 00:45:49 +0300
commit19791bf721348e99c2060ac44973a0d5281f7f4a (patch)
tree3894ac3ac0eef38644805ae038c6b6014bce23f8 /app/services
parent37d8a84b3ac45b64b2e7f80797d5e4451f234d89 (diff)
parente76764edc4c216d8307b028b2aa02b197e7e5095 (diff)
Merge branch 'master' into sh-geo-add-project-deletion-events
Diffstat (limited to 'app/services')
-rw-r--r--app/services/notification_recipient_service.rb8
-rw-r--r--app/services/notification_service.rb6
-rw-r--r--app/services/users/refresh_authorized_projects_service.rb2
3 files changed, 8 insertions, 8 deletions
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb
index 988bd0a7cdb..8d1820bc504 100644
--- a/app/services/notification_recipient_service.rb
+++ b/app/services/notification_recipient_service.rb
@@ -8,7 +8,7 @@ class NotificationRecipientService
@project = project
end
- def build_recipients(target, current_user, action: nil, previous_assignee: nil, skip_current_user: true)
+ def build_recipients(target, current_user, action:, previous_assignee: nil, skip_current_user: true)
custom_action = build_custom_key(action, target)
recipients = target.participants(current_user)
@@ -59,7 +59,7 @@ class NotificationRecipientService
return [] if notification_setting.mention? || notification_setting.disabled?
- return [] if notification_setting.custom? && !notification_setting.public_send(custom_action)
+ return [] if notification_setting.custom? && !notification_setting.event_enabled?(custom_action)
return [] if (notification_setting.watch? || notification_setting.participating?) && NotificationSetting::EXCLUDED_WATCHER_EVENTS.include?(custom_action)
@@ -176,7 +176,7 @@ class NotificationRecipientService
if notification_level
settings = resource.notification_settings.where(level: NotificationSetting.levels[notification_level])
- settings = settings.select { |setting| setting.events[action] } if action.present?
+ settings = settings.select { |setting| setting.event_enabled?(action) } if action.present?
settings.map(&:user_id)
else
resource.notification_settings.pluck(:user_id)
@@ -225,7 +225,7 @@ class NotificationRecipientService
def user_ids_with_global_level_custom(ids, action)
settings = settings_with_global_level_of(:custom, ids)
- settings = settings.select { |setting| setting.events[action] }
+ settings = settings.select { |setting| setting.event_enabled?(action) }
settings.map(&:user_id)
end
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 3de65dd6129..a2dbbaa3d22 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -296,7 +296,7 @@ class NotificationService
end
def issue_moved(issue, new_issue, current_user)
- recipients = NotificationRecipientService.new(issue.project).build_recipients(issue, current_user)
+ recipients = NotificationRecipientService.new(issue.project).build_recipients(issue, current_user, action: 'moved')
recipients.map do |recipient|
email = mailer.issue_moved_email(recipient, issue, new_issue, current_user)
@@ -403,7 +403,7 @@ class NotificationService
end
def approve_mr_email(merge_request, project, current_user)
- recipients = NotificationRecipientService.new(project).build_recipients(merge_request, current_user)
+ recipients = NotificationRecipientService.new(project).build_recipients(merge_request, current_user, action: 'approve')
recipients.each do |recipient|
mailer.approved_merge_request_email(recipient.id, merge_request.id, current_user.id).deliver_later
@@ -411,7 +411,7 @@ class NotificationService
end
def unapprove_mr_email(merge_request, project, current_user)
- recipients = NotificationRecipientService.new(project).build_recipients(merge_request, current_user)
+ recipients = NotificationRecipientService.new(project).build_recipients(merge_request, current_user, action: 'unapprove')
recipients.each do |recipient|
mailer.unapproved_merge_request_email(recipient.id, merge_request.id, current_user.id).deliver_later
diff --git a/app/services/users/refresh_authorized_projects_service.rb b/app/services/users/refresh_authorized_projects_service.rb
index 3e07b811027..f028f5eb0d4 100644
--- a/app/services/users/refresh_authorized_projects_service.rb
+++ b/app/services/users/refresh_authorized_projects_service.rb
@@ -34,7 +34,7 @@ module Users
# Keep trying until we obtain the lease. If we don't do so we may end up
# not updating the list of authorized projects properly. To prevent
# hammering Redis too much we'll wait for a bit between retries.
- sleep(1)
+ sleep(0.1)
end
begin