diff options
author | Robert Speicher <robert@gitlab.com> | 2017-03-24 16:50:42 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-03-24 16:50:42 +0300 |
commit | 671e345f7c33cddd58564e76f11c7fd149b93ac1 (patch) | |
tree | 4656b8a9b334528a40b10d28bb2c8eaa042566f3 /app | |
parent | 3d66c88c61b5c66006cdbd37031c75644909ac1a (diff) | |
parent | bfedbefdfea948c1e83e136f688ce64f2e421574 (diff) |
Merge branch 'add-recipients-logging' into '9-0-stable'
Add logging for bulk update recipients
See merge request !10108
Diffstat (limited to 'app')
-rw-r--r-- | app/services/issuable/bulk_update_service.rb | 6 | ||||
-rw-r--r-- | app/services/notification_service.rb | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/app/services/issuable/bulk_update_service.rb b/app/services/issuable/bulk_update_service.rb index 60891cbb255..70b0f309296 100644 --- a/app/services/issuable/bulk_update_service.rb +++ b/app/services/issuable/bulk_update_service.rb @@ -7,6 +7,9 @@ module Issuable ids = params.delete(:issuable_ids).split(",") items = model_class.where(id: ids) + # https://gitlab.com/gitlab-org/gitlab-ce/issues/28836 + Rails.logger.info("BulkUpdateService received created for type: #{type} with IDs: #{ids.inspect} and params: #{params.inspect}") + %i(state_event milestone_id assignee_id add_label_ids remove_label_ids subscription_event).each do |key| params.delete(key) unless params[key].present? end @@ -14,6 +17,9 @@ module Issuable items.each do |issuable| next unless can?(current_user, :"update_#{type}", issuable) + # https://gitlab.com/gitlab-org/gitlab-ce/issues/28836 + Rails.logger.info("BulkUpdateService created #{update_class} for #{issuable.to_reference(full: true)} with params: #{params.inspect}") + update_class.new(issuable.project, current_user, params).execute(issuable) end diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index f4ec1e7394c..ffc3a0e6658 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -595,17 +595,28 @@ class NotificationService end end + # https://gitlab.com/gitlab-org/gitlab-ce/issues/28836 + def log_recipients(target, recipients, stage) + Rails.logger.info("NotificationService recipients for #{target.class} #{target.id} were #{recipients.compact.map(&:id).sort.inspect} at #{stage}") + rescue => e + Rails.logger.info("NotificationService failed to log with params #{[target, recipients, stage]}: #{e.message}") + end + def build_recipients(target, project, current_user, action: nil, previous_assignee: nil, skip_current_user: true) custom_action = build_custom_key(action, target) recipients = target.participants(current_user) + log_recipients(target, recipients, 'add participants') unless NotificationSetting::EXCLUDED_WATCHER_EVENTS.include?(custom_action) recipients = add_project_watchers(recipients, project) + log_recipients(target, recipients, 'add project watchers') end recipients = add_custom_notifications(recipients, project, custom_action) + log_recipients(target, recipients, 'add custom notifications') recipients = reject_mention_users(recipients, project) + log_recipients(target, recipients, 'reject mention users') recipients = recipients.uniq @@ -617,15 +628,22 @@ class NotificationService recipients << target.assignee end + log_recipients(target, recipients, 'add previous and current assignees') + recipients = reject_muted_users(recipients, project) + log_recipients(target, recipients, 'reject muted users') recipients = add_subscribed_users(recipients, project, target) + log_recipients(target, recipients, 'add subscribed users') if [:new_issue, :new_merge_request].include?(custom_action) recipients = add_labels_subscribers(recipients, project, target) + log_recipients(target, recipients, 'add label subscribers') end recipients = reject_unsubscribed_users(recipients, target) + log_recipients(target, recipients, 'reject unsubscribed users') recipients = reject_users_without_access(recipients, target) + log_recipients(target, recipients, 'reject users without access') recipients.delete(current_user) if skip_current_user |