From: Reed Loden Date: Tue, 6 Jul 2010 00:44:13 +0000 (-0500) Subject: Bug 554964 - Show if a user is a "Default CC" under the Product Responsibilities... X-Git-Tag: bugzilla-3.7.2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=108eb83fae1e54f9746698246551e188dede26cb;p=thirdparty%2Fbugzilla.git Bug 554964 - Show if a user is a "Default CC" under the Product Responsibilities section of editusers.cgi. [r=mkanat a=mkanat] --- diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 71ade2f016..4bd3d2d775 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -380,14 +380,22 @@ $Template::Stash::PRIVATE = undef; $Template::Stash::LIST_OPS->{ contains } = sub { my ($list, $item) = @_; - return grep($_ eq $item, @$list); + if (ref $item && $item->isa('Bugzilla::Object')) { + return grep($_->id == $item->id, @$list); + } else { + return grep($_ eq $item, @$list); + } }; $Template::Stash::LIST_OPS->{ containsany } = sub { my ($list, $items) = @_; foreach my $item (@$items) { - return 1 if grep($_ eq $item, @$list); + if (ref $item && $item->isa('Bugzilla::Object')) { + return 1 if grep($_->id == $item->id, @$list); + } else { + return 1 if grep($_ eq $item, @$list); + } } return 0; }; diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index cb3f75fa8f..b9405e4121 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -1152,11 +1152,14 @@ sub product_responsibilities { return $self->{'product_resp'} if defined $self->{'product_resp'}; return [] unless $self->id; - my $list = $dbh->selectall_arrayref('SELECT product_id, id + my $list = $dbh->selectall_arrayref('SELECT components.product_id, components.id FROM components - WHERE initialowner = ? - OR initialqacontact = ?', - {Slice => {}}, ($self->id, $self->id)); + LEFT JOIN component_cc + ON components.id = component_cc.component_id + WHERE components.initialowner = ? + OR components.initialqacontact = ? + OR component_cc.user_id = ?', + {Slice => {}}, ($self->id, $self->id, $self->id)); unless ($list) { $self->{'product_resp'} = []; diff --git a/template/en/default/admin/users/responsibilities.html.tmpl b/template/en/default/admin/users/responsibilities.html.tmpl index bbf121a265..5c9c3f317c 100644 --- a/template/en/default/admin/users/responsibilities.html.tmpl +++ b/template/en/default/admin/users/responsibilities.html.tmpl @@ -29,6 +29,7 @@ Component Default Assignee Default QA Contact + Default CC [% FOREACH component = item.components %] @@ -48,6 +49,9 @@ [% component.$responsibility.id == otheruser.id ? "X" : " " %] [% END %] + + [% component.initial_cc.contains(otheruser) ? "X" : " " %] + [% END %]