summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-05-14 01:58:26 +0200
committerlpsolit%gmail.com <>2007-05-14 01:58:26 +0200
commitafa011924df93865e9d392843a26ed337e7f6cf8 (patch)
tree1f9f726748a0a9310131b89b2e543a8be2e55713 /Bugzilla
parent6976f410c2d5ccc6e932de4cd669813b6ae678c0 (diff)
downloadbugzilla-afa011924df93865e9d392843a26ed337e7f6cf8.tar.gz
bugzilla-afa011924df93865e9d392843a26ed337e7f6cf8.tar.xz
Bug 327077: Implement a way to get all the components with a given default assignee (owner) and/or default QA contact - Patch by Frédéric Buclin <LpSolit@gmail.com> r=bkor a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/User.pm29
1 files changed, 24 insertions, 5 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 6d0922abf..a14549f84 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -917,14 +917,33 @@ sub product_responsibilities {
return $self->{'product_resp'} if defined $self->{'product_resp'};
return [] unless $self->id;
- my $comp_ids = $dbh->selectcol_arrayref('SELECT id FROM components
- WHERE initialowner = ?
- OR initialqacontact = ?',
- undef, ($self->id, $self->id));
+ my $list = $dbh->selectall_arrayref('SELECT product_id, id
+ FROM components
+ WHERE initialowner = ?
+ OR initialqacontact = ?',
+ {Slice => {}}, ($self->id, $self->id));
+
+ unless ($list) {
+ $self->{'product_resp'} = [];
+ return $self->{'product_resp'};
+ }
+ my @prod_ids = map {$_->{'product_id'}} @$list;
+ my $products = Bugzilla::Product->new_from_list(\@prod_ids);
# We cannot |use| it, because Component.pm already |use|s User.pm.
require Bugzilla::Component;
- $self->{'product_resp'} = Bugzilla::Component->new_from_list($comp_ids);
+ my @comp_ids = map {$_->{'id'}} @$list;
+ my $components = Bugzilla::Component->new_from_list(\@comp_ids);
+
+ my @prod_list;
+ # @$products is already sorted alphabetically.
+ foreach my $prod (@$products) {
+ # We use @components instead of $prod->components because we only want
+ # components where the user is either the default assignee or QA contact.
+ push(@prod_list, {product => $prod,
+ components => [grep {$_->product_id == $prod->id} @$components]});
+ }
+ $self->{'product_resp'} = \@prod_list;
return $self->{'product_resp'};
}