From 43b1f5e40d845512f091dd3980efaed6b959ff04 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre <dbalexandre@gmail.com> Date: Mon, 20 Feb 2017 14:45:40 -0300 Subject: [PATCH] Reuse User#find_by_any_email on UserFormatter#find_by_email --- lib/gitlab/github_import/user_formatter.rb | 12 ++---------- 1 file 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 -- GitLab