[bugzilla-gnome-org-extensions] developers: Move Product hack into separate file



commit 36e2ff20146079f6d71b794679d01845874bd36a
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Sat Nov 8 18:34:49 2014 +0100

    developers: Move Product hack into separate file

 Developers/Extension.pm   |   15 +--------------
 Developers/lib/Product.pm |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 14 deletions(-)
---
diff --git a/Developers/Extension.pm b/Developers/Extension.pm
index 18eba9a..0d044d4 100644
--- a/Developers/Extension.pm
+++ b/Developers/Extension.pm
@@ -25,11 +25,11 @@ 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;
 
 our $VERSION = '0.01';
 
 BEGIN {
-        *Bugzilla::Product::developers = \&developers;
         *Bugzilla::User::is_developer = \&is_developer;
 }
 
@@ -65,19 +65,6 @@ sub object_end_of_update {
     maybe_rename_developers_group($object, $old_object, $changes);
 }
 
-sub developers {
-    my ($self) = @_;
-
-    if (!defined $self->{'developers'}) {
-        $self->{'developers'} = [];
-
-        my $group = Bugzilla::Group->new({ name => $self->name . '_developers' });
-        $self->{developers} = $group ? $group->members_non_inherited : [];
-    }
-
-    return $self->{'developers'};
-}
-
 sub is_developer {
     my ($self, $product) = @_;
 
diff --git a/Developers/lib/Product.pm b/Developers/lib/Product.pm
new file mode 100644
index 0000000..45c7534
--- /dev/null
+++ b/Developers/lib/Product.pm
@@ -0,0 +1,25 @@
+package Bugzilla::Extension::Developers::Product;
+
+use strict;
+use warnings;
+use Bugzilla::Group;
+use Bugzilla::Product;
+
+sub developers {
+    my ($self) = @_;
+
+    if (!defined $self->{'developers'}) {
+        $self->{'developers'} = [];
+
+        my $group = Bugzilla::Group->new({ name => $self->name . '_developers' });
+        $self->{developers} = $group ? $group->members_non_inherited : [];
+    }
+
+    return $self->{'developers'};
+}
+
+BEGIN {
+        *Bugzilla::Product::developers = \&developers;
+}
+
+1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]