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
44b9eb10
Commit
44b9eb10
authored
Dec 11, 2017
by
Douwe Maan
Committed by
Winnie Hellmann
Dec 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve conflicts in app/models/user.rb
parent
de56e4b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
27 deletions
+7
-27
app/models/user.rb
app/models/user.rb
+7
-27
No files found.
app/models/user.rb
View file @
44b9eb10
...
@@ -329,13 +329,8 @@ class User < ActiveRecord::Base
...
@@ -329,13 +329,8 @@ class User < ActiveRecord::Base
#
#
# Returns an ActiveRecord::Relation.
# Returns an ActiveRecord::Relation.
def
search
(
query
)
def
search
(
query
)
<<<<<<<
HEAD
=======
table
=
arel_table
query
=
query
.
downcase
query
=
query
.
downcase
pattern
=
User
.
to_pattern
(
query
)
>>>>>>>
f45fc58d84
...
Merge
branch
'bvl-10-2-email-disclosure'
into
'security-10-2'
order
=
<<~
SQL
order
=
<<~
SQL
CASE
CASE
WHEN users.name = %{query} THEN 0
WHEN users.name = %{query} THEN 0
...
@@ -345,16 +340,11 @@ class User < ActiveRecord::Base
...
@@ -345,16 +340,11 @@ class User < ActiveRecord::Base
END
END
SQL
SQL
<<<<<<<
HEAD
fuzzy_search
(
query
,
[
:name
,
:email
,
:username
])
.
reorder
(
order
%
{
query:
ActiveRecord
::
Base
.
connection
.
quote
(
query
)
},
:name
)
=======
where
(
where
(
table
[
:name
].
matches
(
pattern
)
fuzzy_arel_match
(
:name
,
query
)
.
or
(
table
[
:email
].
eq
(
query
))
.
or
(
fuzzy_arel_match
(
:username
,
query
))
.
or
(
table
[
:username
].
matches
(
pattern
))
.
or
(
arel_table
[
:email
].
eq
(
query
))
).
reorder
(
order
%
{
query:
ActiveRecord
::
Base
.
connection
.
quote
(
query
)
},
:name
)
).
reorder
(
order
%
{
query:
ActiveRecord
::
Base
.
connection
.
quote
(
query
)
},
:name
)
>>>>>>>
f45fc58d84
...
Merge
branch
'bvl-10-2-email-disclosure'
into
'security-10-2'
end
end
# searches user by given pattern
# searches user by given pattern
...
@@ -362,28 +352,18 @@ class User < ActiveRecord::Base
...
@@ -362,28 +352,18 @@ class User < ActiveRecord::Base
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
def
search_with_secondary_emails
(
query
)
def
search_with_secondary_emails
(
query
)
query
=
query
.
downcase
email_table
=
Email
.
arel_table
email_table
=
Email
.
arel_table
<<<<<<<
HEAD
matched_by_emails_user_ids
=
email_table
matched_by_emails_user_ids
=
email_table
.
project
(
email_table
[
:user_id
])
.
project
(
email_table
[
:user_id
])
.
where
(
Email
.
fuzzy_arel_match
(
:email
,
query
))
.
where
(
email_table
[
:email
].
eq
(
query
))
where
(
where
(
fuzzy_arel_match
(
:name
,
query
)
fuzzy_arel_match
(
:name
,
query
)
.
or
(
fuzzy_arel_match
(
:email
,
query
))
.
or
(
fuzzy_arel_match
(
:username
,
query
))
.
or
(
fuzzy_arel_match
(
:username
,
query
))
.
or
(
arel_table
[
:email
].
eq
(
query
))
.
or
(
arel_table
[
:id
].
in
(
matched_by_emails_user_ids
))
.
or
(
arel_table
[
:id
].
in
(
matched_by_emails_user_ids
))
=======
query
=
query
.
downcase
pattern
=
User
.
to_pattern
(
query
)
matched_by_emails_user_ids
=
email_table
.
project
(
email_table
[
:user_id
]).
where
(
email_table
[
:email
].
eq
(
query
))
where
(
table
[
:name
].
matches
(
pattern
)
.
or
(
table
[
:email
].
eq
(
query
))
.
or
(
table
[
:username
].
matches
(
pattern
))
.
or
(
table
[
:id
].
in
(
matched_by_emails_user_ids
))
>>>>>>>
f45fc58d84
...
Merge
branch
'bvl-10-2-email-disclosure'
into
'security-10-2'
)
)
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