[bugzilla-gnome-org-extensions] developers: Simplify User::is_developer function
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] developers: Simplify User::is_developer function
- Date: Thu, 20 Nov 2014 22:04:45 +0000 (UTC)
commit b77b499f48e0d6d62af63db8f77395c55c1746f6
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Sat Nov 8 18:57:58 2014 +0100
developers: Simplify User::is_developer function
Developers/lib/User.pm | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/Developers/lib/User.pm b/Developers/lib/User.pm
index 02f6123..25fa379 100644
--- a/Developers/lib/User.pm
+++ b/Developers/lib/User.pm
@@ -5,6 +5,7 @@ use warnings;
use Bugzilla::User;
use Bugzilla::Extension::Developers::Util;
use Bugzilla::Extension::Developers::Product;
+use List::MoreUtils qw{any};
sub is_developer {
my ($self, $product) = @_;
@@ -12,16 +13,9 @@ sub is_developer {
if ($product) {
# Given the only use of this is being passed bug.product_obj,
# at the moment the performance of this should be fine.
- my $devs = $product->developers;
- my $is_dev = grep { $_->id == $self->id } @$devs;
-
- return $is_dev ? 1 : 0;
- }
- else {
- return $self->in_group(dev()) ? 1 : 0;
+ return any { $_->id == $self->id } @{$product->developers()};
}
-
- return 0;
+ return $self->in_group(dev());
}
BEGIN {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]