Avoid unnecessary use of Arel to find users by external uid

parent 5c72ba0f
...@@ -355,11 +355,9 @@ module Github ...@@ -355,11 +355,9 @@ module Github
def user_id_by_external_uid(id) def user_id_by_external_uid(id)
return nil unless id return nil unless id
identities = ::Identity.arel_table
::User.select(:id) ::User.select(:id)
.joins(:identities) .joins(:identities)
.where(identities[:provider].eq(:github).and(identities[:extern_uid].eq(id))) .merge(::Identity.where(provider: :github, extern_uid: id))
.first&.id .first&.id
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment