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
|
||||||
end
|
end
|
||||||
|
|
||||||
def issue_dropdown_options(issuable, has_multiple_assignees = true)
|
def issue_assignees_dropdown_options
|
||||||
options = {
|
{
|
||||||
toggle_class: 'js-user-search js-assignee-search js-multiselect js-save-user-data',
|
toggle_class: 'js-user-search js-assignee-search js-multiselect js-save-user-data',
|
||||||
title: 'Select assignee',
|
title: 'Select assignee',
|
||||||
filter: true,
|
filter: true,
|
||||||
|
@ -27,8 +27,8 @@ module FormHelper
|
||||||
first_user: current_user&.username,
|
first_user: current_user&.username,
|
||||||
null_user: true,
|
null_user: true,
|
||||||
current_user: true,
|
current_user: true,
|
||||||
project_id: issuable.project.try(:id),
|
project_id: @project.id,
|
||||||
field_name: "#{issuable.class.model_name.param_key}[assignee_ids][]",
|
field_name: 'issue[assignee_ids][]',
|
||||||
default_label: 'Unassigned',
|
default_label: 'Unassigned',
|
||||||
'max-select': 1,
|
'max-select': 1,
|
||||||
'dropdown-header': 'Assignee',
|
'dropdown-header': 'Assignee',
|
||||||
|
@ -38,13 +38,5 @@ module FormHelper
|
||||||
current_user_info: current_user.to_json(only: [:id, :name])
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
- if issuable.assignees.length === 0
|
- if issuable.assignees.length === 0
|
||||||
= hidden_field_tag "#{issuable.to_ability_name}[assignee_ids][]", 0, id: nil, data: { meta: '' }
|
= 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)}"
|
= 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.
|
# the original method, resulting in infinite recurison when called.
|
||||||
# This is likely a bug with helper modules included into dynamically generated view classes.
|
# 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.
|
# 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)
|
original_issue_dropdown_options = FormHelper.instance_method(:issue_assignees_dropdown_options)
|
||||||
allow_any_instance_of(FormHelper).to receive(:issue_dropdown_options).and_wrap_original do |original, *args|
|
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 = original_issue_dropdown_options.bind(original.receiver).call(*args)
|
||||||
options[:data][:per_page] = 2
|
options[:data][:per_page] = 2
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue