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
5e576a85
Commit
5e576a85
authored
Aug 07, 2019
by
Markus Koller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deprecation warning for dangerous order usage
parent
4fa5825e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
app/models/user.rb
app/models/user.rb
+6
-4
No files found.
app/models/user.rb
View file @
5e576a85
...
...
@@ -438,18 +438,20 @@ class User < ApplicationRecord
order
=
<<~
SQL
CASE
WHEN users.name =
%{query}
THEN 0
WHEN users.username =
%{query}
THEN 1
WHEN users.email =
%{query}
THEN 2
WHEN users.name =
:query
THEN 0
WHEN users.username =
:query
THEN 1
WHEN users.email =
:query
THEN 2
ELSE 3
END
SQL
sanitized_order_sql
=
Arel
.
sql
(
sanitize_sql_array
([
order
,
query:
query
]))
where
(
fuzzy_arel_match
(
:name
,
query
,
lower_exact_match:
true
)
.
or
(
fuzzy_arel_match
(
:username
,
query
,
lower_exact_match:
true
))
.
or
(
arel_table
[
:email
].
eq
(
query
))
).
reorder
(
order
%
{
query:
ApplicationRecord
.
connection
.
quote
(
query
)
}
,
:name
)
).
reorder
(
sanitized_order_sql
,
:name
)
end
# Limits the result set to users _not_ in the given query/list of IDs.
...
...
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