Commit 38c2d4b6 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 305451: GetGroupsByUserId() in buglist.cgi returns bad data (regression) -…

Bug 305451: GetGroupsByUserId() in buglist.cgi returns bad data (regression) - Patch by Joel Peshkin <bugreport@peshkin.net> r=LpSolit a=justdave
parent 947c6e6e
...@@ -309,25 +309,20 @@ sub GetQuip { ...@@ -309,25 +309,20 @@ sub GetQuip {
return $quip; return $quip;
} }
sub GetGroupsByUserId { sub GetGroups {
my ($userid) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
return if !$userid;
# Create an array where each item is a hash. The hash contains # Create an array where each item is a hash. The hash contains
# as keys the name of the columns, which point to the value of # as keys the name of the columns, which point to the value of
# the columns for that row. # the columns for that row.
my $grouplist = Bugzilla->user->groups_as_string;
my $groups = $dbh->selectall_arrayref( my $groups = $dbh->selectall_arrayref(
"SELECT DISTINCT groups.id, name, description, isactive "SELECT id, name, description, isactive
FROM groups FROM groups
INNER JOIN user_group_map WHERE id IN ($grouplist)
ON user_group_map.group_id = groups.id
WHERE user_id = ?
AND isbless = 0
AND isbuggroup = 1 AND isbuggroup = 1
ORDER BY description " ORDER BY description "
, {Slice => {}}, ($userid)); , {Slice => {}});
return $groups; return $groups;
} }
...@@ -994,7 +989,7 @@ if ($dotweak) { ...@@ -994,7 +989,7 @@ if ($dotweak) {
$vars->{'bugstatuses'} = [ keys %$bugstatuses ]; $vars->{'bugstatuses'} = [ keys %$bugstatuses ];
# The groups to which the user belongs. # The groups to which the user belongs.
$vars->{'groups'} = GetGroupsByUserId($::userid); $vars->{'groups'} = GetGroups();
# If all bugs being changed are in the same product, the user can change # If all bugs being changed are in the same product, the user can change
# their version and component, so generate a list of products, a list of # their version and component, so generate a list of products, a list of
......
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