summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm9
-rw-r--r--Bugzilla/Component.pm23
-rw-r--r--Bugzilla/DB/Schema.pm13
3 files changed, 43 insertions, 2 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index d309d0bc2..5ac2f2b0b 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -115,7 +115,6 @@ sub VALIDATORS {
alias => \&_check_alias,
bug_file_loc => \&_check_bug_file_loc,
bug_severity => \&_check_bug_severity,
- cc => \&_check_cc,
comment => \&_check_comment,
commentprivacy => \&_check_commentprivacy,
deadline => \&_check_deadline,
@@ -353,6 +352,8 @@ sub run_create_validators {
$class->_check_assigned_to($component, $params->{assigned_to});
$params->{qa_contact} =
$class->_check_qa_contact($component, $params->{qa_contact});
+ $params->{cc} = $class->_check_cc($component, $params->{cc});
+
# Callers cannot set Reporter, currently.
$params->{reporter} = Bugzilla->user->id;
@@ -506,7 +507,7 @@ sub _check_bug_status {
}
sub _check_cc {
- my ($invocant, $ccs) = @_;
+ my ($invocant, $component, $ccs) = @_;
return [] unless $ccs;
my %cc_ids;
@@ -515,6 +516,10 @@ sub _check_cc {
my $id = login_to_id($person, THROW_ERROR);
$cc_ids{$id} = 1;
}
+
+ # Enforce Default CC
+ $cc_ids{$_->id} = 1 foreach (@{$component->initial_cc});
+
return [keys %cc_ids];
}
diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm
index abd3711f5..4b9856feb 100644
--- a/Bugzilla/Component.pm
+++ b/Bugzilla/Component.pm
@@ -14,6 +14,8 @@
#
# Contributor(s): Tiago R. Mello <timello@async.com.br>
# Frédéric Buclin <LpSolit@gmail.com>
+# Max Kanat-Alexander <mkanat@bugzilla.org>
+# Akamai Technologies <bugzilla-dev@akamai.com>
use strict;
@@ -154,6 +156,21 @@ sub flag_types {
return $self->{'flag_types'};
}
+sub initial_cc {
+ my $self = shift;
+
+ my $dbh = Bugzilla->dbh;
+
+ if (!defined $self->{'initial_cc'}) {
+ my $cc_ids = $dbh->selectcol_arrayref(
+ "SELECT user_id FROM component_cc WHERE component_id = ?",
+ undef, $self->id);
+ my $initial_cc = Bugzilla::User->new_from_list($cc_ids);
+ $self->{'initial_cc'} = $initial_cc;
+ }
+ return $self->{'initial_cc'};
+}
+
###############################
#### Accessors ####
###############################
@@ -212,6 +229,7 @@ Bugzilla::Component - Bugzilla product component class.
my $product_id = $component->product_id;
my $default_assignee = $component->default_assignee;
my $default_qa_contact = $component->default_qa_contact;
+ my $initial_cc = $component->initial_cc
my $bug_flag_types = $component->flag_types->{'bug'};
my $attach_flag_types = $component->flag_types->{'attachment'};
@@ -273,6 +291,11 @@ Component.pm represents a Product Component object.
Returns: A Bugzilla::User object.
+=item C<initial_cc>
+
+Returns an arrayref of L<Bugzilla::User> objects representing the
+Initial CC List.
+
=item C<flag_types()>
Description: Returns all bug and attachment flagtypes available for
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index 938ef042a..4235be5ad 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -22,6 +22,7 @@
# Max Kanat-Alexander <mkanat@bugzilla.org>
# Lance Larsh <lance.larsh@oracle.com>
# Dennis Melentyev <dennis.melentyev@infopulse.com.ua>
+# Akamai Technologies <bugzilla-dev@akamai.com>
package Bugzilla::DB::Schema;
@@ -703,6 +704,18 @@ use constant ABSTRACT_SCHEMA => {
],
},
+ component_cc => {
+
+ FIELDS => [
+ user_id => {TYPE => 'INT3', NOTNULL => 1},
+ component_id => {TYPE => 'INT2', NOTNULL => 1},
+ ],
+ INDEXES => [
+ component_cc_user_id_idx => {FIELDS => [qw(component_id user_id)],
+ TYPE => 'UNIQUE'},
+ ],
+ },
+
# Authentication
# --------------