Commit 240cf2e8 authored by Catalin Irimie's avatar Catalin Irimie

Return just a secondary email when searching users

Make clear the intention that, because of the unique constraint, there
can only be one record returned when doing an exact match on the email
parent dbb4caf5
...@@ -633,6 +633,7 @@ class User < ApplicationRecord ...@@ -633,6 +633,7 @@ class User < ApplicationRecord
matched_by_email_user_id = email_table matched_by_email_user_id = email_table
.project(email_table[:user_id]) .project(email_table[:user_id])
.where(email_table[:email].eq(query)) .where(email_table[:email].eq(query))
.take(1) # at most 1 record as there is a unique constraint
where( where(
fuzzy_arel_match(:name, query) fuzzy_arel_match(:name, query)
......
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