[bugzilla-gnome-org-extensions] developers: Move User hack into separate file
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] developers: Move User hack into separate file
- Date: Thu, 20 Nov 2014 22:04:25 +0000 (UTC)
commit 7726a05853dc1d318ada513d485eb929635ff6f0
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Sat Nov 8 18:35:46 2014 +0100
developers: Move User hack into separate file
Developers/Extension.pm | 22 +---------------------
Developers/lib/User.pm | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 21 deletions(-)
---
diff --git a/Developers/Extension.pm b/Developers/Extension.pm
index 0d044d4..fa80683 100644
--- a/Developers/Extension.pm
+++ b/Developers/Extension.pm
@@ -26,13 +26,10 @@ use base qw(Bugzilla::Extension);
# This code for this is in ./extensions/Developers/lib/Util.pm
use Bugzilla::Extension::Developers::Ops;
use Bugzilla::Extension::Developers::Product;
+use Bugzilla::Extension::Developers::User;
our $VERSION = '0.01';
-BEGIN {
- *Bugzilla::User::is_developer = \&is_developer;
-}
-
# See the documentation of Bugzilla::Hook ("perldoc Bugzilla::Hook"
# in the bugzilla directory) for a list of all available hooks.
sub install_update_db {
@@ -65,21 +62,4 @@ sub object_end_of_update {
maybe_rename_developers_group($object, $old_object, $changes);
}
-sub is_developer {
- my ($self, $product) = @_;
-
- 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("developers") ? 1 : 0;
- }
-
- return 0;
-}
-
__PACKAGE__->NAME;
diff --git a/Developers/lib/User.pm b/Developers/lib/User.pm
new file mode 100644
index 0000000..b359739
--- /dev/null
+++ b/Developers/lib/User.pm
@@ -0,0 +1,28 @@
+package Bugzilla::Extension::Developers::User;
+
+use strict;
+use warnings;
+use Bugzilla::User;
+use Bugzilla::Extension::Developers::Product;
+sub is_developer {
+ my ($self, $product) = @_;
+
+ 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("developers") ? 1 : 0;
+ }
+
+ return 0;
+}
+
+BEGIN {
+ *Bugzilla::User::is_developer = \&is_developer;
+}
+
+1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]