summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2009-04-09 15:45:18 +0200
committerlpsolit%gmail.com <>2009-04-09 15:45:18 +0200
commit1ae4394d6db37e7e39a58824d69271f8506a4e41 (patch)
treed3d057f9fbe3fad6dcfca6968be2a7c559649ab3 /Bugzilla/User.pm
parent719303d9928bf0a727478c32f83a39b015a25136 (diff)
downloadbugzilla-1ae4394d6db37e7e39a58824d69271f8506a4e41.tar.gz
bugzilla-1ae4394d6db37e7e39a58824d69271f8506a4e41.tar.xz
Bug 440259 (2nd attempt): User::match should be using Bugzilla::User->new_from_list - Patch by arbingersys <arbingersys@gmail.com> r/a=LpSolit
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm19
1 files changed, 6 insertions, 13 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index b6754c472..2a616a145 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -1017,7 +1017,7 @@ sub match {
if ($wildstr =~ s/\*/\%/g) { # don't do wildcards if no '*' in the string
# Build the query.
trick_taint($wildstr);
- my $query = "SELECT DISTINCT login_name FROM profiles ";
+ my $query = "SELECT DISTINCT userid FROM profiles ";
if (Bugzilla->params->{'usevisibilitygroups'}) {
$query .= "INNER JOIN user_group_map
ON user_group_map.user_id = profiles.userid ";
@@ -1031,15 +1031,12 @@ sub match {
join(', ', (-1, @{$user->visible_groups_inherited})) . ") ";
}
$query .= " AND disabledtext = '' " if $exclude_disabled;
- $query .= " ORDER BY login_name ";
$query .= $dbh->sql_limit($limit) if $limit;
# Execute the query, retrieve the results, and make them into
# User objects.
- my $user_logins = $dbh->selectcol_arrayref($query, undef, ($wildstr, $wildstr));
- foreach my $login_name (@$user_logins) {
- push(@users, new Bugzilla::User({ name => $login_name }));
- }
+ my $user_ids = $dbh->selectcol_arrayref($query, undef, ($wildstr, $wildstr));
+ @users = @{Bugzilla::User->new_from_list($user_ids)};
}
else { # try an exact match
# Exact matches don't care if a user is disabled.
@@ -1055,7 +1052,7 @@ sub match {
if (!scalar(@users) && length($str) >= 3) {
trick_taint($str);
- my $query = "SELECT DISTINCT login_name FROM profiles ";
+ my $query = "SELECT DISTINCT userid FROM profiles ";
if (Bugzilla->params->{'usevisibilitygroups'}) {
$query .= "INNER JOIN user_group_map
ON user_group_map.user_id = profiles.userid ";
@@ -1069,13 +1066,9 @@ sub match {
join(', ', (-1, @{$user->visible_groups_inherited})) . ") ";
}
$query .= " AND disabledtext = '' " if $exclude_disabled;
- $query .= " ORDER BY login_name ";
$query .= $dbh->sql_limit($limit) if $limit;
-
- my $user_logins = $dbh->selectcol_arrayref($query, undef, ($str, $str));
- foreach my $login_name (@$user_logins) {
- push(@users, new Bugzilla::User({ name => $login_name }));
- }
+ my $user_ids = $dbh->selectcol_arrayref($query, undef, ($str, $str));
+ @users = @{Bugzilla::User->new_from_list($user_ids)};
}
return \@users;
}