summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/lib
diff options
context:
space:
mode:
authorDavid Lawrence <dlawrence@mozilla.com>2011-10-05 00:25:23 +0200
committerDavid Lawrence <dlawrence@mozilla.com>2011-10-05 00:25:23 +0200
commit57584dc4744fea59833ef355f7513690d246c70f (patch)
tree805f2b2941eca17eaf97263165d11d9e676ad9d1 /extensions/BMO/lib
parent785580c6c290b93fe25868cfbb5d4e300749de62 (diff)
downloadbugzilla-57584dc4744fea59833ef355f7513690d246c70f.tar.gz
bugzilla-57584dc4744fea59833ef355f7513690d246c70f.tar.xz
more porting work
Diffstat (limited to 'extensions/BMO/lib')
-rw-r--r--extensions/BMO/lib/Data.pm31
-rw-r--r--extensions/BMO/lib/FakeBug.pm2
-rw-r--r--extensions/BMO/lib/Reports.pm62
3 files changed, 83 insertions, 12 deletions
diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm
index 17b84a37e..ccc729a6d 100644
--- a/extensions/BMO/lib/Data.pm
+++ b/extensions/BMO/lib/Data.pm
@@ -27,7 +27,7 @@ use base qw(Exporter);
use Tie::IxHash;
our @EXPORT_OK = qw($cf_visible_in_products
- $cf_flags
+ $cf_flags $cf_disabled_flags
%group_to_cc_map
$blocking_trusted_setters
$blocking_trusted_requesters
@@ -78,7 +78,6 @@ tie(%$cf_visible_in_products, "Tie::IxHash",
"Add-on SDK" => [],
"addons.mozilla.org" => [],
"AUS" => [],
- "Camino" => [],
"Core Graveyard" => [],
"Core" => [],
"Directory" => [],
@@ -108,6 +107,9 @@ tie(%$cf_visible_in_products, "Tie::IxHash",
"Server Operations: Security",
],
},
+ qw/^cf_office$/ => {
+ "mozilla.org" => ["Server Operations: Desktop Issues"],
+ },
qr/^cf_crash_signature$/ => {
"addons.mozilla.org" => [],
"Add-on SDK" => [],
@@ -136,6 +138,9 @@ tie(%$cf_visible_in_products, "Tie::IxHash",
"Mozilla Labs" => [],
"mozilla.org" => [],
"Tech Evangelism" => [],
+ },
+ qw/^cf_due_date$/ => {
+ "Mozilla Reps" => [],
},
);
@@ -144,6 +149,28 @@ our $cf_flags = [
qr/^cf_(?:blocking|tracking|status)_/,
];
+# List of disabled fields.
+# Temp kludge until custom fields can be disabled correctly upstream.
+# Disabled fields are hidden unless they have a value set
+our $cf_disabled_flags = [
+ 'cf_blocking_20',
+ 'cf_status_20',
+ 'cf_tracking_firefox5',
+ 'cf_status_firefox5',
+ 'cf_blocking_thunderbird32',
+ 'cf_status_thunderbird32',
+ 'cf_blocking_thunderbird30',
+ 'cf_status_thunderbird30',
+ 'cf_blocking_seamonkey21',
+ 'cf_status_seamonkey21',
+ 'cf_tracking_seamonkey22',
+ 'cf_status_seamonkey22',
+ 'cf_tracking_firefox6',
+ 'cf_status_firefox6',
+ 'cf_tracking_thunderbird6',
+ 'cf_status_thunderbird6',
+];
+
# Who to CC on particular bugmails when certain groups are added or removed.
our %group_to_cc_map = (
'bugzilla-security' => 'security@bugzilla.org',
diff --git a/extensions/BMO/lib/FakeBug.pm b/extensions/BMO/lib/FakeBug.pm
index d8cebe379..5610f5433 100644
--- a/extensions/BMO/lib/FakeBug.pm
+++ b/extensions/BMO/lib/FakeBug.pm
@@ -1,7 +1,5 @@
package Bugzilla::Extension::BMO::FakeBug;
-use strict;
-
# hack to allow the bug entry templates to use check_can_change_field to see if
# various field values should be available to the current user
diff --git a/extensions/BMO/lib/Reports.pm b/extensions/BMO/lib/Reports.pm
index d1f979beb..f291e72e7 100644
--- a/extensions/BMO/lib/Reports.pm
+++ b/extensions/BMO/lib/Reports.pm
@@ -31,7 +31,8 @@ use DateTime;
use base qw(Exporter);
our @EXPORT_OK = qw(user_activity_report
- triage_reports);
+ triage_reports
+ group_admins);
sub user_activity_report {
my ($vars) = @_;
@@ -303,14 +304,16 @@ sub triage_reports {
# load product and components from input
- my $product = Bugzilla::Product->new({ name => $input->{'product'} });
+ my $product = Bugzilla::Product->new({ name => $input->{'product'} })
+ || ThrowUserError('invalid_object', { object => 'Product', value => $input->{'product'} });
my @component_ids;
if ($input->{'component'} ne '') {
my $ra_components = ref($input->{'component'})
? $input->{'component'} : [ $input->{'component'} ];
foreach my $component_name (@$ra_components) {
- my $component = Bugzilla::Component->new({ name => $component_name, product => $product });
+ my $component = Bugzilla::Component->new({ name => $component_name, product => $product })
+ || ThrowUserError('invalid_object', { object => 'Component', value => $component_name });
push @component_ids, $component->id;
}
}
@@ -319,15 +322,22 @@ sub triage_reports {
my $filter_commenter = $input->{'filter_commenter'};
my $filter_commenter_on = $input->{'commenter'};
+ my $filter_last = $input->{'filter_last'};
+ my $filter_last_period = $input->{'last'};
+
+ if (!$filter_commenter || $filter_last) {
+ $filter_commenter = '1';
+ $filter_commenter_on = 'reporter';
+ }
+
my $filter_commenter_id;
if ($filter_commenter && $filter_commenter_on eq 'is') {
Bugzilla::User::match_field({ 'commenter_is' => {'type' => 'single'} });
- my $user = Bugzilla::User->new({ name => $input->{'commenter_is'} });
+ my $user = Bugzilla::User->new({ name => $input->{'commenter_is'} })
+ || ThrowUserError('invalid_object', { object => 'User', value => $input->{'commenter_is'} });
$filter_commenter_id = $user ? $user->id : 0;
}
- my $filter_last = $input->{'filter_last'};
- my $filter_last_period = $input->{'last'};
my $filter_last_time;
if ($filter_last) {
if ($filter_last_period eq 'is') {
@@ -338,11 +348,10 @@ sub triage_reports {
$filter_last_period = 14 if $filter_last_period < 14;
}
}
- my $now = (time);
- $filter_commenter = 1 unless $filter_commenter || $filter_last;
# form sql queries
+ my $now = (time);
my $bugs_sql = "
SELECT bug_id, short_desc, reporter, creation_ts
FROM bugs
@@ -473,4 +482,41 @@ sub triage_reports {
$vars->{'input'} = $input;
}
+sub group_admins {
+ my ($vars, $filter) = @_;
+ my $dbh = Bugzilla->dbh;
+ my $user = Bugzilla->user;
+
+ $user->in_group('editusers')
+ || ThrowUserError('auth_failure', { group => 'editusers',
+ action => 'run',
+ object => 'group_admins' });
+
+ my $query = "
+ SELECT groups.name, " .
+ $dbh->sql_group_concat('profiles.login_name', "','", 1) . "
+ FROM groups
+ LEFT JOIN user_group_map
+ ON user_group_map.group_id = groups.id
+ AND user_group_map.isbless = 1
+ AND user_group_map.grant_type = 0
+ LEFT JOIN profiles
+ ON user_group_map.user_id = profiles.userid
+ WHERE groups.isbuggroup = 1
+ GROUP BY groups.name";
+
+ my @groups;
+ foreach my $group (@{ $dbh->selectall_arrayref($query) }) {
+ my @admins;
+ if ($group->[1]) {
+ foreach my $admin (split(/,/, $group->[1])) {
+ push(@admins, Bugzilla::User->new({ name => $admin }));
+ }
+ }
+ push(@groups, { name => $group->[0], admins => \@admins });
+ }
+
+ $vars->{'groups'} = \@groups;
+}
+
1;