summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-04-24 16:15:24 +0100
committerPhil Hughes <me@iamphill.com>2017-04-24 16:15:24 +0100
commitdab6aab220ebaf88d69ca5d54181dd8f14404e9f (patch)
treebd32f770f25dbea824d0d3d3ccb8cae14c064cd1
parent90f73438998e9f6eaefd19c446569eed6cfae34d (diff)
downloadgitlab-ce-dab6aab220ebaf88d69ca5d54181dd8f14404e9f.tar.gz
Assignee filter on group issues/merge requests only loads group usersgroup-assignee-dropdown-send-group-id
Closes #29490
-rw-r--r--app/assets/javascripts/users_select.js1
-rw-r--r--app/views/shared/issuable/_filter.html.haml2
-rw-r--r--changelogs/unreleased/group-assignee-dropdown-send-group-id.yml4
-rw-r--r--spec/features/groups/issues_spec.rb16
4 files changed, 22 insertions, 1 deletions
diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js
index 30902767705..0344ce9ffb4 100644
--- a/app/assets/javascripts/users_select.js
+++ b/app/assets/javascripts/users_select.js
@@ -33,6 +33,7 @@
var $block, $collapsedSidebar, $dropdown, $loading, $selectbox, $value, abilityName, assignTo, assigneeTemplate, collapsedAssigneeTemplate, defaultLabel, firstUser, issueURL, selectedId, showAnyUser, showNullUser, showMenuAbove;
$dropdown = $(dropdown);
options.projectId = $dropdown.data('project-id');
+ options.groupId = $dropdown.data('group-id');
options.showCurrentUser = $dropdown.data('current-user');
options.todoFilter = $dropdown.data('todo-filter');
options.todoStateFilter = $dropdown.data('todo-state-filter');
diff --git a/app/views/shared/issuable/_filter.html.haml b/app/views/shared/issuable/_filter.html.haml
index c72268473ca..1a12f110945 100644
--- a/app/views/shared/issuable/_filter.html.haml
+++ b/app/views/shared/issuable/_filter.html.haml
@@ -21,7 +21,7 @@
- if params[:assignee_id].present?
= hidden_field_tag(:assignee_id, params[:assignee_id])
= dropdown_tag(user_dropdown_label(params[:assignee_id], "Assignee"), options: { toggle_class: "js-user-search js-filter-submit js-assignee-search", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit",
- placeholder: "Search assignee", data: { any_user: "Any Assignee", first_user: current_user.try(:username), null_user: true, current_user: true, project_id: @project.try(:id), selected: params[:assignee_id], field_name: "assignee_id", default_label: "Assignee" } })
+ placeholder: "Search assignee", data: { any_user: "Any Assignee", first_user: current_user.try(:username), null_user: true, current_user: true, project_id: @project.try(:id), group_id: @group&.id, selected: params[:assignee_id], field_name: "assignee_id", default_label: "Assignee" } })
.filter-item.inline.milestone-filter
= render "shared/issuable/milestone_dropdown", selected: finder.milestones.try(:first), name: :milestone_title, show_any: true, show_upcoming: true, show_started: true
diff --git a/changelogs/unreleased/group-assignee-dropdown-send-group-id.yml b/changelogs/unreleased/group-assignee-dropdown-send-group-id.yml
new file mode 100644
index 00000000000..4f153f9817d
--- /dev/null
+++ b/changelogs/unreleased/group-assignee-dropdown-send-group-id.yml
@@ -0,0 +1,4 @@
+---
+title: Fixed group issues assignee dropdown loading all users
+merge_request:
+author:
diff --git a/spec/features/groups/issues_spec.rb b/spec/features/groups/issues_spec.rb
index 1b3747c390b..45f57845c74 100644
--- a/spec/features/groups/issues_spec.rb
+++ b/spec/features/groups/issues_spec.rb
@@ -23,4 +23,20 @@ feature 'Group issues page', feature: true do
it_behaves_like "an autodiscoverable RSS feed without a private token"
end
end
+
+ context 'assignee', :js do
+ let(:access_level) { ProjectFeature::ENABLED }
+ let(:user) { user_in_group }
+ let(:user2) { user_outside_group }
+ let(:path) { issues_group_path(group) }
+
+ it 'filters by only group users' do
+ click_button('Assignee')
+
+ wait_for_ajax
+
+ expect(find('.dropdown-menu-assignee')).to have_link(user.name)
+ expect(find('.dropdown-menu-assignee')).not_to have_link(user2.name)
+ end
+ end
end