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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
3ef56667
Commit
3ef56667
authored
Apr 12, 2019
by
Wei-Meng Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only show in autocomplete when author active
parent
d25cdca6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
app/finders/autocomplete/users_finder.rb
app/finders/autocomplete/users_finder.rb
+1
-1
changelogs/unreleased/weimeng-user-autocomplete-fix.yml
changelogs/unreleased/weimeng-user-autocomplete-fix.yml
+5
-0
spec/finders/autocomplete/users_finder_spec.rb
spec/finders/autocomplete/users_finder_spec.rb
+12
-4
No files found.
app/finders/autocomplete/users_finder.rb
View file @
3ef56667
...
@@ -31,7 +31,7 @@ module Autocomplete
...
@@ -31,7 +31,7 @@ module Autocomplete
# Include current user if available to filter by "Me"
# Include current user if available to filter by "Me"
items
.
unshift
(
current_user
)
if
prepend_current_user?
items
.
unshift
(
current_user
)
if
prepend_current_user?
if
prepend_author?
&&
(
author
=
User
.
find_by_id
(
author_id
))
if
(
prepend_author?
&&
author
=
User
.
find_by_id
(
author_id
))
&&
author
.
active?
items
.
unshift
(
author
)
items
.
unshift
(
author
)
end
end
end
end
...
...
changelogs/unreleased/weimeng-user-autocomplete-fix.yml
0 → 100644
View file @
3ef56667
---
title
:
Only show in autocomplete when author active
merge_request
:
27292
author
:
type
:
fixed
spec/finders/autocomplete/users_finder_spec.rb
View file @
3ef56667
...
@@ -26,9 +26,17 @@ describe Autocomplete::UsersFinder do
...
@@ -26,9 +26,17 @@ describe Autocomplete::UsersFinder do
it
{
is_expected
.
to
match_array
([
project
.
owner
])
}
it
{
is_expected
.
to
match_array
([
project
.
owner
])
}
context
'when author_id passed'
do
context
'when author_id passed'
do
let
(
:params
)
{
{
author_id:
user2
.
id
}
}
context
'and author is active'
do
let
(
:params
)
{
{
author_id:
user1
.
id
}
}
it
{
is_expected
.
to
match_array
([
project
.
owner
,
user2
])
}
it
{
is_expected
.
to
match_array
([
project
.
owner
,
user1
])
}
end
context
'and author is blocked'
do
let
(
:params
)
{
{
author_id:
user2
.
id
}
}
it
{
is_expected
.
to
match_array
([
project
.
owner
])
}
end
end
end
end
end
...
@@ -104,9 +112,9 @@ describe Autocomplete::UsersFinder do
...
@@ -104,9 +112,9 @@ describe Autocomplete::UsersFinder do
end
end
context
'when filtered by author_id'
do
context
'when filtered by author_id'
do
let
(
:params
)
{
{
author_id:
user
2
.
id
}
}
let
(
:params
)
{
{
author_id:
user
1
.
id
}
}
it
{
is_expected
.
to
match_array
([
user
2
,
user
1
,
external_user
,
omniauth_user
,
current_user
])
}
it
{
is_expected
.
to
match_array
([
user1
,
external_user
,
omniauth_user
,
current_user
])
}
end
end
end
end
end
end
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