Enable user searching by partial email for administrator accounts
Description
Some time ago the searching by partial email was removed from Gitlab (gitlab-ce#34910)
It was the very useful feature for us. We were filtering the employees and then fetching their activity (contributions) via the API, but now it is not possible.
Proposal
Could you please enable this feature for the administrator accounts?
Links / references
E-mail address disclosure through member search fields (gitlab-foss#34910 (closed))
Implementation Guide
It's possible to try with where(fuzzy_arel_match(:email, query, use_minimum_char_limit: options[:use_minimum_char_limit]) but care needs to be taken to limit only to administrators
- Modify
User.searchto accept a newpartial_email_queryoption - Combine
with_public_emailandwith_primary_or_secondary_emailto a new method, for ease of updating later. - Pass
partial_email_queryoption to new method from 2. - If
partial_email_query, usefuzzy_arel_match, otherwise use current code that matches exactly - In the relevant places where User.search is called, set
partial_email_query: trueif the current user is an admin.
Edited by Thong Kuah