BigW Consortium Gitlab

Commit bfedbefd by Sean McGivern

Add logging for bulk update recipients

parent 9d96367f
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment