Avoid unnecessary use of Arel to find users by external uid

parent 5c72ba0f
......@@ -355,11 +355,9 @@ module Github
def user_id_by_external_uid(id)
return nil unless id
identities = ::Identity.arel_table
::User.select(:id)
.joins(:identities)
.where(identities[:provider].eq(:github).and(identities[:extern_uid].eq(id)))
.merge(::Identity.where(provider: :github, extern_uid: id))
.first&.id
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