Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce

This commit is contained in:
Rémy Coutable 2016-11-17 18:15:50 +01:00
commit 6061e94c39
3 changed files with 45 additions and 2 deletions

View file

@ -55,7 +55,13 @@ class AutocompleteController < ApplicationController
def find_users def find_users
@users = @users =
if @project if @project
@project.team.users user_ids = @project.team.users.map(&:id)
if params[:author_id].present?
user_ids << params[:author_id]
end
User.where(id: user_ids)
elsif params[:group_id].present? elsif params[:group_id].present?
group = Group.find(params[:group_id]) group = Group.find(params[:group_id])
return render_404 unless can?(current_user, :read_group, group) return render_404 unless can?(current_user, :read_group, group)

View file

@ -0,0 +1,4 @@
---
title: Assignee dropdown now searches author of issue or merge request
merge_request:
author:

View file

@ -1,7 +1,9 @@
require 'rails_helper' require 'rails_helper'
feature 'Issue Sidebar', feature: true do feature 'Issue Sidebar', feature: true do
let(:project) { create(:project) } include WaitForAjax
let(:project) { create(:project, :public) }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
let!(:user) { create(:user)} let!(:user) { create(:user)}
@ -10,6 +12,37 @@ feature 'Issue Sidebar', feature: true do
login_as(user) login_as(user)
end end
context 'assignee', js: true do
let(:user2) { create(:user) }
let(:issue2) { create(:issue, project: project, author: user2) }
before do
project.team << [user, :developer]
visit_issue(project, issue2)
find('.block.assignee .edit-link').click
wait_for_ajax
end
it 'shows author in assignee dropdown' do
page.within '.dropdown-menu-user' do
expect(page).to have_content(user2.name)
end
end
it 'shows author when filtering assignee dropdown' do
page.within '.dropdown-menu-user' do
find('.dropdown-input-field').native.send_keys user2.name
sleep 1 # Required to wait for end of input delay
wait_for_ajax
expect(page).to have_content(user2.name)
end
end
end
context 'as a allowed user' do context 'as a allowed user' do
before do before do
project.team << [user, :developer] project.team << [user, :developer]