FormHelper#issue_assignees_dropdown_options never has multiple assignees
Only EE supports multiple issue assignees, so this CE code should not contain code to have multiple assignees. EE will override the multiple issue assignees feature by overriding this method.
This commit is contained in:
parent
458c292f41
commit
91c58ed14d
3 changed files with 7 additions and 15 deletions
|
@ -16,8 +16,8 @@ module FormHelper
|
|||
end
|
||||
end
|
||||
|
||||
def issue_dropdown_options(issuable, has_multiple_assignees = true)
|
||||
options = {
|
||||
def issue_assignees_dropdown_options
|
||||
{
|
||||
toggle_class: 'js-user-search js-assignee-search js-multiselect js-save-user-data',
|
||||
title: 'Select assignee',
|
||||
filter: true,
|
||||
|
@ -27,8 +27,8 @@ module FormHelper
|
|||
first_user: current_user&.username,
|
||||
null_user: true,
|
||||
current_user: true,
|
||||
project_id: issuable.project.try(:id),
|
||||
field_name: "#{issuable.class.model_name.param_key}[assignee_ids][]",
|
||||
project_id: @project.id,
|
||||
field_name: 'issue[assignee_ids][]',
|
||||
default_label: 'Unassigned',
|
||||
'max-select': 1,
|
||||
'dropdown-header': 'Assignee',
|
||||
|
@ -38,13 +38,5 @@ module FormHelper
|
|||
current_user_info: current_user.to_json(only: [:id, :name])
|
||||
}
|
||||
}
|
||||
|
||||
if has_multiple_assignees
|
||||
options[:title] = 'Select assignee(s)'
|
||||
options[:data][:'dropdown-header'] = 'Assignee(s)'
|
||||
options[:data].delete(:'max-select')
|
||||
end
|
||||
|
||||
options
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
- if issuable.assignees.length === 0
|
||||
= hidden_field_tag "#{issuable.to_ability_name}[assignee_ids][]", 0, id: nil, data: { meta: '' }
|
||||
|
||||
= dropdown_tag(users_dropdown_label(issuable.assignees), options: issue_dropdown_options(issuable,false))
|
||||
= dropdown_tag(users_dropdown_label(issuable.assignees), options: issue_assignees_dropdown_options)
|
||||
= link_to 'Assign to me', '#', class: "assign-to-me-link #{'hide' if issuable.assignees.include?(current_user)}"
|
||||
|
|
|
@ -31,8 +31,8 @@ describe 'New/edit issue', :feature, :js do
|
|||
# the original method, resulting in infinite recurison when called.
|
||||
# This is likely a bug with helper modules included into dynamically generated view classes.
|
||||
# To work around this, we have to hold on to and call to the original implementation manually.
|
||||
original_issue_dropdown_options = FormHelper.instance_method(:issue_dropdown_options)
|
||||
allow_any_instance_of(FormHelper).to receive(:issue_dropdown_options).and_wrap_original do |original, *args|
|
||||
original_issue_dropdown_options = FormHelper.instance_method(:issue_assignees_dropdown_options)
|
||||
allow_any_instance_of(FormHelper).to receive(:issue_assignees_dropdown_options).and_wrap_original do |original, *args|
|
||||
options = original_issue_dropdown_options.bind(original.receiver).call(*args)
|
||||
options[:data][:per_page] = 2
|
||||
|
||||
|
|
Loading…
Reference in a new issue