From 776ee55030257105efd7df2196d9aee01e8281ad Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 27 May 2015 13:32:27 +0800 Subject: Bug 1162427: the "reset assignee to default" checkbox / functionality should be visible --- Bugzilla/Bug.pm | 3 +++ extensions/BugModal/Extension.pm | 16 ++++++++++++++++ .../template/en/default/bug_modal/edit.html.tmpl | 2 ++ .../template/en/default/bug_modal/field.html.tmpl | 3 +++ 4 files changed, 24 insertions(+) diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index d22ebc1ce..d105dd005 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -2415,6 +2415,9 @@ sub set_all { my $params = {}; %$params = %$input_params; + # BMO - allow extensions to morph params + Bugzilla::Hook::process('bug_start_of_set_all', { bug => $self, params => $params }); + # You cannot mark bugs as duplicate when changing several bugs at once # (because currently there is no way to check for duplicate loops in that # situation). You also cannot set the alias of several bugs at once. diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm index f09a53425..0c007c2d9 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -256,6 +256,22 @@ sub template_before_process { $vars->{tracking_flags_table} = \@tracking_table; } +sub bug_start_of_set_all { + my ($self, $args) = @_; + my $bug = $args->{bug}; + my $params = $args->{params}; + + # reset to the component defaults if not supplied + if (exists $params->{assigned_to} && (!defined $params->{assigned_to} || $params->{assigned_to} eq '')) { + $params->{assigned_to} = $bug->component_obj->default_assignee->login; + } + if (exists $params->{qa_contact} && (!defined $params->{qa_contact} || $params->{qa_contact} eq '') + && $bug->component_obj->default_qa_contact->id) + { + $params->{qa_contact} = $bug->component_obj->default_qa_contact->login; + } +} + sub webservice { my ($self, $args) = @_; my $dispatch = $args->{dispatch}; diff --git a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl index ba3973bcf..fa87066fd 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -466,6 +466,7 @@ field_type = constants.FIELD_TYPE_USER hide_on_view = 1 append_content = 1 + default = bug.component_obj.default_assignee.login %]