summaryrefslogtreecommitdiffstats
path: root/process_bug.cgi
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2016-11-09 19:37:41 +0100
committerDylan William Hardison <dylan@hardison.net>2016-11-09 19:37:41 +0100
commit04e3d20ef470de50b17a6cdb4df13f990a27e11d (patch)
tree6d7f2be5cf6119c7f6877aef1cfd3d2b9a180d3e /process_bug.cgi
parent2938094f14bcfd3ae80fa6478986a51fffde499a (diff)
downloadbugzilla-04e3d20ef470de50b17a6cdb4df13f990a27e11d.tar.gz
bugzilla-04e3d20ef470de50b17a6cdb4df13f990a27e11d.tar.xz
Revert "Bug 1313766 - Bugzilla::Bug->send_changes() should not output HTML directly"
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-xprocess_bug.cgi87
1 files changed, 38 insertions, 49 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index 0b1b30dbf..80018cfb3 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -111,6 +111,8 @@ my $user_match_fields = {
Bugzilla::Hook::process('bug_user_match_fields', { fields => $user_match_fields });
Bugzilla::User::match_field($user_match_fields);
+print $cgi->header() unless Bugzilla->usage_mode == USAGE_MODE_EMAIL;
+
# Check for a mid-air collision. Currently this only works when updating
# an individual bug.
my $delta_ts = $cgi->param('delta_ts') || '';
@@ -156,7 +158,6 @@ if ($delta_ts) {
$cgi->param('token', issue_hash_token([$first_bug->id, $first_bug->delta_ts]));
# Warn the user about the mid-air collision and ask them what to do.
- print $cgi->header() unless Bugzilla->usage_mode == USAGE_MODE_EMAIL;
$template->process("bug/process/midair.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
@@ -185,9 +186,6 @@ $vars->{'title_tag'} = "bug_processed";
my $action;
if (defined $cgi->param('id')) {
$action = $user->setting('post_bug_submit_action');
- if ($action ne 'nothing' && $action ne 'same_bug' && $action ne 'next_bug') {
- ThrowCodeError("invalid_post_bug_submit_action");
- }
if ($action eq 'next_bug') {
my $bug_list_obj = $user->recent_search_for($first_bug);
@@ -378,7 +376,6 @@ if (defined $cgi->param('id')) {
##############################
# Do Actual Database Updates #
##############################
-my $sent_changes;
foreach my $bug (@bug_objects) {
my $changes = $bug->update();
@@ -392,58 +389,50 @@ foreach my $bug (@bug_objects) {
}
}
- $sent_changes = $bug->send_changes($changes);
+ my $recipient_count = $bug->send_changes($changes, $vars);
}
# Delete the session token used for the mass-change.
delete_token($token) unless $cgi->param('id');
-# BMO: add show_bug_format hook for experimental UI work
-my $format_params = {
- format => scalar $cgi->param('format'),
- ctype => scalar $cgi->param('ctype'),
-};
-Bugzilla::Hook::process('show_bug_format', $format_params);
-my $format = $template->get_format("bug/show",
- $format_params->{format},
- $format_params->{ctype});
-
-if (Bugzilla->usage_mode != USAGE_MODE_EMAIL) {
- print $cgi->header();
-
- foreach my $sent_change (@$sent_changes) {
- my $params = $sent_change->{params};
- my $sent_bugmail = $sent_change->{sent_bugmail};
- $vars->{$_} = $params->{$_} foreach keys %$params;
- $vars->{'sent_bugmail'} = $sent_bugmail;
- $template->process("bug/process/results.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
- $vars->{'header_done'} = 1;
- }
-
- if ($action eq 'next_bug' or $action eq 'same_bug') {
- my $bug = $vars->{'bug'};
- if ($bug and $user->can_see_bug($bug)) {
- if ($action eq 'same_bug') {
- # $bug->update() does not update the internal structure of
- # the bug sufficiently to display the bug with the new values.
- # (That is, if we just passed in the old Bug object, we'd get
- # a lot of old values displayed.)
- $bug = Bugzilla::Bug->new($bug->id);
- $vars->{'bug'} = $bug;
- }
- $vars->{'bugs'} = [$bug];
- if ($action eq 'next_bug') {
- $vars->{'nextbug'} = $bug->id;
- }
-
- $template->process($format->{template}, $vars)
- || ThrowTemplateError($template->error());
- exit;
+if (Bugzilla->usage_mode == USAGE_MODE_EMAIL) {
+ # Do nothing.
+}
+elsif ($action eq 'next_bug' or $action eq 'same_bug') {
+ my $bug = $vars->{'bug'};
+ if ($bug and $user->can_see_bug($bug)) {
+ if ($action eq 'same_bug') {
+ # $bug->update() does not update the internal structure of
+ # the bug sufficiently to display the bug with the new values.
+ # (That is, if we just passed in the old Bug object, we'd get
+ # a lot of old values displayed.)
+ $bug = new Bugzilla::Bug($bug->id);
+ $vars->{'bug'} = $bug;
}
+ $vars->{'bugs'} = [$bug];
+ if ($action eq 'next_bug') {
+ $vars->{'nextbug'} = $bug->id;
+ }
+
+ # BMO: add show_bug_format hook for experimental UI work
+ my $format_params = {
+ format => scalar $cgi->param('format'),
+ ctype => scalar $cgi->param('ctype'),
+ };
+ Bugzilla::Hook::process('show_bug_format', $format_params);
+ my $format = $template->get_format("bug/show",
+ $format_params->{format},
+ $format_params->{ctype});
+ $template->process($format->{template}, $vars)
+ || ThrowTemplateError($template->error());
+ exit;
}
+} elsif ($action ne 'nothing') {
+ ThrowCodeError("invalid_post_bug_submit_action");
+}
- # End the response page.
+# End the response page.
+unless (Bugzilla->usage_mode == USAGE_MODE_EMAIL) {
$template->process("bug/navigate.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
$template->process("global/footer.html.tmpl", $vars)