Commit 108eb83f authored by Reed Loden's avatar Reed Loden

Bug 554964 - Show if a user is a "Default CC" under the Product Responsibilities…

Bug 554964 - Show if a user is a "Default CC" under the Product Responsibilities section of editusers.cgi. [r=mkanat a=mkanat]
parent ba4585ae
...@@ -380,14 +380,22 @@ $Template::Stash::PRIVATE = undef; ...@@ -380,14 +380,22 @@ $Template::Stash::PRIVATE = undef;
$Template::Stash::LIST_OPS->{ contains } = $Template::Stash::LIST_OPS->{ contains } =
sub { sub {
my ($list, $item) = @_; 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 } = $Template::Stash::LIST_OPS->{ containsany } =
sub { sub {
my ($list, $items) = @_; my ($list, $items) = @_;
foreach my $item (@$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; return 0;
}; };
......
...@@ -1152,11 +1152,14 @@ sub product_responsibilities { ...@@ -1152,11 +1152,14 @@ sub product_responsibilities {
return $self->{'product_resp'} if defined $self->{'product_resp'}; return $self->{'product_resp'} if defined $self->{'product_resp'};
return [] unless $self->id; 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 FROM components
WHERE initialowner = ? LEFT JOIN component_cc
OR initialqacontact = ?', ON components.id = component_cc.component_id
{Slice => {}}, ($self->id, $self->id)); WHERE components.initialowner = ?
OR components.initialqacontact = ?
OR component_cc.user_id = ?',
{Slice => {}}, ($self->id, $self->id, $self->id));
unless ($list) { unless ($list) {
$self->{'product_resp'} = []; $self->{'product_resp'} = [];
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<th>Component</th> <th>Component</th>
<th>Default Assignee</th> <th>Default Assignee</th>
<th>Default QA Contact</th> <th>Default QA Contact</th>
<th>Default CC</th>
</tr> </tr>
[% FOREACH component = item.components %] [% FOREACH component = item.components %]
<tr> <tr>
...@@ -48,6 +49,9 @@ ...@@ -48,6 +49,9 @@
[% component.$responsibility.id == otheruser.id ? "X" : "&nbsp;" %] [% component.$responsibility.id == otheruser.id ? "X" : "&nbsp;" %]
</td> </td>
[% END %] [% END %]
<td class="center">
[% component.initial_cc.contains(otheruser) ? "X" : "&nbsp;" %]
</td>
</tr> </tr>
[% END %] [% END %]
</tbody> </tbody>
......
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