summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-02-20 14:45:40 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-02-20 14:48:12 -0300
commit43b1f5e40d845512f091dd3980efaed6b959ff04 (patch)
tree28fbd6cc181bfec676b1cd566729ddecc0677267
parent20128693eb2b060735f8ff2547ce00f0296881ac (diff)
downloadgitlab-ce-43b1f5e40d845512f091dd3980efaed6b959ff04.tar.gz
Reuse User#find_by_any_email on UserFormatter#find_by_email
-rw-r--r--lib/gitlab/github_import/user_formatter.rb12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/gitlab/github_import/user_formatter.rb b/lib/gitlab/github_import/user_formatter.rb
index f0237d054da..04c2964da20 100644
--- a/lib/gitlab/github_import/user_formatter.rb
+++ b/lib/gitlab/github_import/user_formatter.rb
@@ -24,17 +24,9 @@ module Gitlab
def find_by_email
return nil unless email
- users = ::User.arel_table
- emails = ::Email.arel_table
- left_join_emails = users.join(emails, Arel::Nodes::OuterJoin).on(
- users[:id].eq(emails[:user_id])
- ).join_sources
-
- User.select(:id)
- .joins(left_join_emails)
- .where(users[:email].eq(email).or(emails[:email].eq(email)))
- .first.try(:id)
+ User.find_by_any_email(email)
+ .try(:id)
end
def find_by_external_uid