From 271477d8c26794abd8310e2abb89b746204660af Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Thu, 22 Apr 2010 11:02:17 -0700 Subject: Bug 560009: Use firstidx from List::MoreUtils instead of lsearch r=timello, a=mkanat --- Bugzilla/User.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Bugzilla/User.pm') diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 5c6209811..351dddfae 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -562,10 +562,11 @@ sub get_products_by_permission { # No need to go further if the user has no "special" privs. return [] unless scalar(@$product_ids); + my %product_map = map { $_ => 1 } @$product_ids; # We will restrict the list to products the user can see. my $selectable_products = $self->get_selectable_products; - my @products = grep {lsearch($product_ids, $_->id) > -1} @$selectable_products; + my @products = grep { $product_map{$_->id} } @$selectable_products; return \@products; } @@ -1490,7 +1491,7 @@ sub is_mover { if (!defined $self->{'is_mover'}) { my @movers = map { trim($_) } split(',', Bugzilla->params->{'movers'}); $self->{'is_mover'} = ($self->id - && lsearch(\@movers, $self->login) != -1); + && grep { $_ eq $self->login } @movers); } return $self->{'is_mover'}; } -- cgit v1.2.3-24-g4f1b