summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2016-09-27 15:55:12 +0200
committerDavid Lawrence <dkl@mozilla.com>2016-09-27 15:55:12 +0200
commit8affa3eab39d5b438067f3b5b0490be597b19bbc (patch)
treebf288ce157376b3166e6e5c62c65c7dfe91578c7 /Bugzilla
parent0ebea6d9fac5b7da3844829883ee76707c711061 (diff)
downloadbugzilla-8affa3eab39d5b438067f3b5b0490be597b19bbc.tar.gz
bugzilla-8affa3eab39d5b438067f3b5b0490be597b19bbc.tar.xz
ug 1268317 - Add Triage Contact to Components as an Editable Field (everything else)
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Component.pm46
-rw-r--r--Bugzilla/Field.pm1
-rw-r--r--Bugzilla/Search.pm47
3 files changed, 94 insertions, 0 deletions
diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm
index b44f78733..68024c2fa 100644
--- a/Bugzilla/Component.pm
+++ b/Bugzilla/Component.pm
@@ -38,6 +38,7 @@ use constant DB_COLUMNS => qw(
initialqacontact
description
isactive
+ triage_owner_id
);
use constant UPDATE_COLUMNS => qw(
@@ -46,6 +47,7 @@ use constant UPDATE_COLUMNS => qw(
initialqacontact
description
isactive
+ triage_owner_id
);
use constant REQUIRED_FIELD_MAP => {
@@ -61,6 +63,7 @@ use constant VALIDATORS => {
initial_cc => \&_check_cc_list,
name => \&_check_name,
isactive => \&Bugzilla::Object::check_boolean,
+ triage_owner_id => \&_check_triage_owner,
};
use constant VALIDATOR_DEPENDENCIES => {
@@ -242,6 +245,13 @@ sub _check_cc_list {
return [keys %cc_ids];
}
+sub _check_triage_owner {
+ my ($invocant, $triage_owner) = @_;
+ my $triage_owner_id;
+ $triage_owner_id = Bugzilla::User->check($triage_owner)->id if $triage_owner;
+ return $triage_owner_id;
+}
+
###############################
#### Methods ####
###############################
@@ -317,6 +327,12 @@ sub set_cc_list {
# Reset the list of CC user objects.
delete $self->{initial_cc};
}
+sub set_triage_owner {
+ my ($self, $triage_owner) = @_;
+ $self->set('triage_owner_id', $triage_owner);
+ # Reset the triage owner object
+ delete $self->{triage_owner};
+}
sub bug_count {
my $self = shift;
@@ -360,6 +376,17 @@ sub default_qa_contact {
return $self->{'default_qa_contact'};
}
+sub triage_owner {
+ my $self = shift;
+ if (!defined $self->{'triage_owner'}) {
+ my $params = $self->{'triage_owner_id'}
+ ? { id => $self->{'triage_owner_id'}, cache => 1 }
+ : $self->{'triage_owner_id'};
+ $self->{'triage_owner'} = Bugzilla::User->new($params);
+ }
+ return $self->{'triage_owner'};
+}
+
sub flag_types {
my ($self, $params) = @_;
$params ||= {};
@@ -454,6 +481,7 @@ Bugzilla::Component - Bugzilla product component class.
my $default_assignee = $component->default_assignee;
my $default_qa_contact = $component->default_qa_contact;
my $initial_cc = $component->initial_cc;
+ my $triage_owner = $component->triage_owner;
my $product = $component->product;
my $bug_flag_types = $component->flag_types->{'bug'};
my $attach_flag_types = $component->flag_types->{'attachment'};
@@ -465,6 +493,7 @@ Bugzilla::Component - Bugzilla product component class.
product => $product,
initialowner => $user_login1,
initialqacontact => $user_login2,
+ triage_owner => $user_login3,
description => $description});
$component->set_name($new_name);
@@ -472,6 +501,7 @@ Bugzilla::Component - Bugzilla product component class.
$component->set_default_assignee($new_login_name);
$component->set_default_qa_contact($new_login_name);
$component->set_cc_list(\@new_login_names);
+ $component->set_triage_owner($new_triage_owner);
$component->update();
$component->remove_from_db;
@@ -542,6 +572,15 @@ Component.pm represents a Product Component object.
Returns: An arrayref of L<Bugzilla::User> objects.
+=item C<triage_owner>
+
+ Description: Returns the user responsible for performing triage on
+ bugs for this component.
+
+ Params: none
+
+ Returns: A Bugzilla::User object.
+
=item C<flag_types()>
Description: Returns all bug and attachment flagtypes available for
@@ -605,6 +644,12 @@ Component.pm represents a Product Component object.
Returns: Nothing.
+=item C<set_triage_owner>
+
+ Description: Changes the triage owner of the component.
+
+ Params: $new_triage_owner - login name of the new triage owner (string).
+
=item C<update()>
Description: Write changes made to the component into the DB.
@@ -644,6 +689,7 @@ Component.pm represents a Product Component object.
or an empty string to clear it.
initial_cc - an arrayref of login names to add to the
CC list by default.
+ triage_owner - login name of the default triage owner
Returns: A Bugzilla::Component object.
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm
index a9e124115..c46895924 100644
--- a/Bugzilla/Field.pm
+++ b/Bugzilla/Field.pm
@@ -265,6 +265,7 @@ use constant DEFAULT_FIELDS => (
{name => 'bug_interest_ts', desc => 'Bug Interest', buglist => 1,
type => FIELD_TYPE_DATETIME},
{name => 'comment_tag', desc => 'Comment Tag'},
+ {name => 'triage_owner', desc => 'Triage Owner', buglist => 1},
);
################
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 19419817a..cddedb3f0 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -336,6 +336,9 @@ use constant OPERATOR_FIELD_OVERRIDE => {
_non_changed => \&_bug_interest_ts,
_default => \&_invalid_operator,
},
+ triage_owner => {
+ _non_changed => \&_triage_owner_nonchanged,
+ },
# Custom Fields
FIELD_TYPE_FREETEXT, { _non_changed => \&_nullable },
FIELD_TYPE_BUG_ID, { _non_changed => \&_nullable_int },
@@ -371,6 +374,9 @@ sub SPECIAL_PARSING {
# BMO - Add ability to use pronoun for bug mentors field
bug_mentor => \&_commenter_pronoun,
+
+ # BMO - add ability to use pronoun for triage owners
+ triage_owner => \&_triage_owner_pronoun,
};
foreach my $field (Bugzilla->active_custom_fields) {
if ($field->type == FIELD_TYPE_DATETIME) {
@@ -447,6 +453,7 @@ use constant SPECIAL_ORDER => {
use constant COLUMN_DEPENDS => {
classification => ['product'],
percentage_complete => ['actual_time', 'remaining_time'],
+ triage_owner => ['component'],
};
# This describes tables that must be joined when you want to display
@@ -515,6 +522,13 @@ sub COLUMN_JOINS {
to => 'id',
},
},
+ 'triage_owner' => {
+ table => 'profiles',
+ as => 'map_triage_owner',
+ from => 'map_component.triage_owner_id',
+ to => 'userid',
+ join => 'LEFT',
+ },
keywords => {
table => 'keywords',
then_to => {
@@ -625,6 +639,13 @@ sub COLUMNS {
assignee_last_login => 'assignee.last_seen_date',
);
+ if ($user->id) {
+ $special_sql{triage_owner} = 'map_triage_owner.login_name';
+ }
+ else {
+ $special_sql{triage_owner} = 'map_triage_owner.realname';
+ }
+
# Backward-compatibility for old field names. Goes new_name => old_name.
# These are here and not in _translate_old_column because the rest of the
# code actually still uses the old names, while the fielddefs table uses
@@ -2444,6 +2465,22 @@ sub _commenter_pronoun {
}
}
+# XXX only works with %user% currently
+sub _triage_owner_pronoun {
+ my ($self, $args) = @_;
+ my $value = $args->{value};
+ my $user = $self->_user;
+ if ($value eq "%user%") {
+ if ($user->id) {
+ $args->{value} = $user->id;
+ $args->{quoted} = $args->{value};
+ $args->{value_is_id} = 1;
+ } else {
+ ThrowUserError('login_required_for_pronoun');
+ }
+ }
+}
+
#####################################################################
# Search Functions
#####################################################################
@@ -2855,6 +2892,16 @@ sub _classification_nonchanged {
"classifications.id", "classifications", $term);
}
+sub _triage_owner_nonchanged {
+ my ($self, $args) = @_;
+ $self->_add_extra_column('triage_owner');
+ $args->{full_field} = $args->{value_is_id} ? 'profiles.userid' : 'profiles.login_name';
+ $self->_do_operator_function($args);
+ my $term = $args->{term};
+ $args->{term} = build_subselect('bugs.component_id', 'components.id',
+ 'profiles JOIN components ON components.triage_owner_id = profiles.userid', $term);
+}
+
sub _nullable {
my ($self, $args) = @_;
my $field = $args->{full_field};