Module: Gitlab::QuickActions::MergeRequestActions

Extended by:
ActiveSupport::Concern
Includes:
Dsl
Included in:
QuickActions::InterpretService
Defined in:
lib/gitlab/quick_actions/merge_request_actions.rb

Instance Method Summary collapse

Instance Method Details

#merge_orchestration_serviceObject


390
391
392
# File 'lib/gitlab/quick_actions/merge_request_actions.rb', line 390

def merge_orchestration_service
  @merge_orchestration_service ||= ::MergeRequests::MergeOrchestrationService.new(project, current_user)
end

#preferred_auto_merge_strategy(merge_request) ⇒ Object


394
395
396
# File 'lib/gitlab/quick_actions/merge_request_actions.rb', line 394

def preferred_auto_merge_strategy(merge_request)
  merge_orchestration_service.preferred_auto_merge_strategy(merge_request)
end

#reviewer_users_sentence(users) ⇒ Object


367
368
369
# File 'lib/gitlab/quick_actions/merge_request_actions.rb', line 367

def reviewer_users_sentence(users)
  reviewers_to_add(users).map(&:to_reference).to_sentence
end

#reviewers_for_removal(users) ⇒ Object


371
372
373
374
375
376
377
378
# File 'lib/gitlab/quick_actions/merge_request_actions.rb', line 371

def reviewers_for_removal(users)
  reviewers = quick_action_target.reviewers
  if users.present? && quick_action_target.allows_multiple_reviewers?
    users
  else
    reviewers
  end
end

#reviewers_to_add(users) ⇒ Object


380
381
382
383
384
385
386
387
388
# File 'lib/gitlab/quick_actions/merge_request_actions.rb', line 380

def reviewers_to_add(users)
  return if users.blank?

  if quick_action_target.allows_multiple_reviewers?
    users
  else
    [users.first]
  end
end