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
1150ab80
Commit
1150ab80
authored
Apr 16, 2019
by
Wei-Meng Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Abstract author into private method
parent
3ef56667
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
app/finders/autocomplete/users_finder.rb
app/finders/autocomplete/users_finder.rb
+9
-1
No files found.
app/finders/autocomplete/users_finder.rb
View file @
1150ab80
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
module
Autocomplete
module
Autocomplete
class
UsersFinder
class
UsersFinder
include
Gitlab
::
Utils
::
StrongMemoize
# The number of users to display in the results is hardcoded to 20, and
# The number of users to display in the results is hardcoded to 20, and
# pagination is not supported. This ensures that performance remains
# pagination is not supported. This ensures that performance remains
# consistent and removes the need for implementing keyset pagination to
# consistent and removes the need for implementing keyset pagination to
...
@@ -31,7 +33,7 @@ module Autocomplete
...
@@ -31,7 +33,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
))
&&
author
.
active?
if
prepend_author?
&&
author
&
.
active?
items
.
unshift
(
author
)
items
.
unshift
(
author
)
end
end
end
end
...
@@ -41,6 +43,12 @@ module Autocomplete
...
@@ -41,6 +43,12 @@ module Autocomplete
private
private
def
author
strong_memoize
(
:author
)
do
User
.
find_by_id
(
author_id
)
end
end
# Returns the users based on the input parameters, as an Array.
# Returns the users based on the input parameters, as an Array.
#
#
# This method is separate so it is easier to extend in EE.
# This method is separate so it is easier to extend in EE.
...
...
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