Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
70f52918
Commit
70f52918
authored
Aug 06, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always add current user to autocomplete controller to support filter by "Me"
Partial fix #2202
parent
caf4c0dd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
2 deletions
+28
-2
CHANGELOG
CHANGELOG
+1
-0
app/controllers/autocomplete_controller.rb
app/controllers/autocomplete_controller.rb
+2
-0
features/steps/project/forked_merge_requests.rb
features/steps/project/forked_merge_requests.rb
+3
-2
spec/controllers/autocomplete_controller_spec.rb
spec/controllers/autocomplete_controller_spec.rb
+22
-0
No files found.
CHANGELOG
View file @
70f52918
Please view this file on the master branch, on stable branches it's out of date.
v 7.14.0 (unreleased)
- Always add current user to autocomplete controller to support filter by "Me" (Stan Hu)
- Fix multi-line syntax highlighting (Stan Hu)
- Fix network graph when branch name has single quotes (Stan Hu)
- Add "Confirm user" button in user admin page (Stan Hu)
...
...
app/controllers/autocomplete_controller.rb
View file @
70f52918
...
...
@@ -33,6 +33,8 @@ class AutocompleteController < ApplicationController
@users
=
@users
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@users
=
@users
.
active
@users
=
@users
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
# Always include current user if available to filter by "Me"
@users
=
User
.
find
(
@users
.
pluck
(
:id
)
+
[
current_user
.
id
]).
uniq
if
current_user
render
json:
@users
,
only:
[
:name
,
:username
,
:id
],
methods:
[
:avatar_url
]
end
...
...
features/steps/project/forked_merge_requests.rb
View file @
70f52918
...
...
@@ -138,10 +138,11 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
end
step
'I should see the users from the target project ID'
do
expect
(
page
).
to
have_selector
(
'.user-result'
,
visible:
true
,
count:
2
)
expect
(
page
).
to
have_selector
(
'.user-result'
,
visible:
true
,
count:
3
)
users
=
page
.
all
(
'.user-name'
)
expect
(
users
[
0
].
text
).
to
eq
'Unassigned'
expect
(
users
[
1
].
text
).
to
eq
@project
.
users
.
first
.
name
expect
(
users
[
1
].
text
).
to
eq
current_user
.
name
expect
(
users
[
2
].
text
).
to
eq
@project
.
users
.
first
.
name
end
# Verify a link is generated against the correct project
...
...
spec/controllers/autocomplete_controller_spec.rb
View file @
70f52918
...
...
@@ -4,6 +4,7 @@ describe AutocompleteController do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user2
)
{
create
(
:user
)
}
let!
(
:non_member
)
{
create
(
:user
)
}
context
'project members'
do
before
do
...
...
@@ -61,6 +62,27 @@ describe AutocompleteController do
end
end
context
'non-member login for public project'
do
let!
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
sign_in
(
non_member
)
project
.
team
<<
[
user
,
:master
]
end
let
(
:body
)
{
JSON
.
parse
(
response
.
body
)
}
describe
'GET #users with project ID'
do
before
do
get
(
:users
,
project_id:
project
.
id
)
end
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
.
size
).
to
eq
2
}
it
{
expect
(
body
.
map
{
|
u
|
u
[
'username'
]
}).
to
match_array
([
user
.
username
,
non_member
.
username
])
}
end
end
context
'all users'
do
before
do
sign_in
(
user
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment