Commit 75ab7e01 authored by wurblzap%gmail.com's avatar wurblzap%gmail.com

Bug 322082: Clean up user selection SQL.

Patch by Marc Schumann <wurblzap@gmail.com>, r=LpSolit, a=justdave
parent 972eed87
......@@ -100,9 +100,15 @@ if ($action eq 'search') {
} else {
$visibleGroups = 1;
if ($grouprestrict eq '1') {
$query .= ', user_group_map AS ugm';
$query .= qq{, user_group_map AS ugm
WHERE ugm.user_id = profiles.userid
AND ugm.isbless = 0
};
$nextCondition = 'AND';
}
else {
$nextCondition = 'WHERE';
}
$nextCondition = 'WHERE';
}
if (!$visibleGroups) {
......@@ -137,9 +143,7 @@ if ($action eq 'search') {
if ($grouprestrict eq '1') {
my $grouplist = join(',',
@{Bugzilla::User->flatten_group_membership($group->id)});
$query .= " $nextCondition profiles.userid = ugm.user_id " .
"AND ugm.group_id IN($grouplist) " .
"AND ugm.isbless = 0";
$query .= " $nextCondition ugm.group_id IN($grouplist) ";
}
$query .= ' ORDER BY profiles.login_name';
......
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