Commit 27e375b4 authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge "Bug 1507777: Allow user search to check secondary emails"

parents 6d779b2f 886cee51
...@@ -252,8 +252,16 @@ class PluginSearchInternal extends PluginSearch { ...@@ -252,8 +252,16 @@ class PluginSearchInternal extends PluginSearch {
private static function match_user_field_expression($field, $alias) { private static function match_user_field_expression($field, $alias) {
if (get_config_plugin('search', 'internal', 'exactusersearch')) { if (get_config_plugin('search', 'internal', 'exactusersearch')) {
if ($field == 'email') {
return '(LOWER(' . $alias . '.email) = ? OR (SELECT email FROM {artefact_internal_profile_email} ai WHERE ai.email = ? AND ai.owner = u.id AND ai.verified = 1) = ?)';
}
else {
return 'LOWER(' . $alias . '.' . $field . ') = ?'; return 'LOWER(' . $alias . '.' . $field . ') = ?';
} }
}
if ($field == 'email') {
return '(' . $alias . '.email ' . db_ilike() . " '%' || ? || '%' OR (SELECT email FROM {artefact_internal_profile_email} ai WHERE ai.email " . db_ilike() . " '%' || ? || '%' AND ai.owner = u.id AND ai.verified = 1 LIMIT 1) " . db_ilike() . " '%' || ? || '%')";
}
return $alias . '.' . $field . ' ' . db_ilike() . " '%' || ? || '%'"; return $alias . '.' . $field . ' ' . db_ilike() . " '%' || ? || '%'";
} }
...@@ -431,7 +439,7 @@ class PluginSearchInternal extends PluginSearch { ...@@ -431,7 +439,7 @@ class PluginSearchInternal extends PluginSearch {
AND ( AND (
' . $termsql . ' ' . $termsql . '
)'; )';
$values = array_pad($values, count($values) + 5, $term); $values = array_pad($values, count($values) + 7, $term);
} }
$firstcols = 'u.id'; $firstcols = 'u.id';
......
Supports Markdown
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