Commit a4d04c0b authored by orozot's avatar orozot

Add toggle method to control use_minimum_char_limit

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/348509
Changelog: changed
parent f7963d40
......@@ -717,13 +717,17 @@ class User < ApplicationRecord
.take(1) # at most 1 record as there is a unique constraint
where(
fuzzy_arel_match(:name, query)
.or(fuzzy_arel_match(:username, query))
fuzzy_arel_match(:name, query, lower_exact_match: false, use_minimum_char_limit: use_minimum_char_limit_toggle)
.or(fuzzy_arel_match(:username, query, lower_exact_match: false, use_minimum_char_limit: use_minimum_char_limit_toggle))
.or(arel_table[:email].eq(query))
.or(arel_table[:id].eq(matched_by_email_user_id))
)
end
def use_minimum_char_limit_toggle
true
end
def by_login(login)
return unless login
......
......@@ -2538,6 +2538,12 @@ RSpec.describe User do
end
end
describe '.use_minimum_char_limit_toggle' do
it 'returns true' do
expect(described_class.use_minimum_char_limit_toggle).to be true
end
end
describe '.find_by_ssh_key_id' do
let_it_be(:user) { create(:user) }
let_it_be(:key) { create(:key, user: user) }
......
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