Commit abde2183 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 440259: User::match should be using Bugzilla::User->new_from_list - Patch by…

Bug 440259: User::match should be using Bugzilla::User->new_from_list - Patch by arbingersys <arbingersys@gmail.com> r=LpSolit a=mkanat
parent ffc663e1
...@@ -1015,7 +1015,7 @@ sub match { ...@@ -1015,7 +1015,7 @@ sub match {
if ($wildstr =~ s/\*/\%/g) { # don't do wildcards if no '*' in the string if ($wildstr =~ s/\*/\%/g) { # don't do wildcards if no '*' in the string
# Build the query. # Build the query.
trick_taint($wildstr); trick_taint($wildstr);
my $query = "SELECT DISTINCT login_name FROM profiles "; my $query = "SELECT DISTINCT userid FROM profiles ";
if (Bugzilla->params->{'usevisibilitygroups'}) { if (Bugzilla->params->{'usevisibilitygroups'}) {
$query .= "INNER JOIN user_group_map $query .= "INNER JOIN user_group_map
ON user_group_map.user_id = profiles.userid "; ON user_group_map.user_id = profiles.userid ";
...@@ -1034,10 +1034,8 @@ sub match { ...@@ -1034,10 +1034,8 @@ sub match {
# Execute the query, retrieve the results, and make them into # Execute the query, retrieve the results, and make them into
# User objects. # User objects.
my $user_logins = $dbh->selectcol_arrayref($query, undef, ($wildstr, $wildstr)); my $user_ids = $dbh->selectcol_arrayref($query, undef, ($wildstr, $wildstr));
foreach my $login_name (@$user_logins) { @users = @{Bugzilla::User->new_from_list($user_ids)};
push(@users, new Bugzilla::User({ name => $login_name }));
}
} }
else { # try an exact match else { # try an exact match
# Exact matches don't care if a user is disabled. # Exact matches don't care if a user is disabled.
...@@ -1053,7 +1051,7 @@ sub match { ...@@ -1053,7 +1051,7 @@ sub match {
if (!scalar(@users) && length($str) >= 3) { if (!scalar(@users) && length($str) >= 3) {
trick_taint($str); trick_taint($str);
my $query = "SELECT DISTINCT login_name FROM profiles "; my $query = "SELECT DISTINCT userid FROM profiles ";
if (Bugzilla->params->{'usevisibilitygroups'}) { if (Bugzilla->params->{'usevisibilitygroups'}) {
$query .= "INNER JOIN user_group_map $query .= "INNER JOIN user_group_map
ON user_group_map.user_id = profiles.userid "; ON user_group_map.user_id = profiles.userid ";
...@@ -1070,10 +1068,8 @@ sub match { ...@@ -1070,10 +1068,8 @@ sub match {
$query .= " ORDER BY login_name "; $query .= " ORDER BY login_name ";
$query .= $dbh->sql_limit($limit) if $limit; $query .= $dbh->sql_limit($limit) if $limit;
my $user_logins = $dbh->selectcol_arrayref($query, undef, ($str, $str)); my $user_ids = $dbh->selectcol_arrayref($query, undef, ($str, $str));
foreach my $login_name (@$user_logins) { @users = @{Bugzilla::User->new_from_list($user_ids)};
push(@users, new Bugzilla::User({ name => $login_name }));
}
} }
return \@users; return \@users;
} }
......
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