Commit 56285b05 authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 425668: Make the body classes and other header information show up properly…

Bug 425668: Make the body classes and other header information show up properly in process_bug.cgi if we're doing same_bug or next_bug Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
parent c0b214bc
...@@ -197,7 +197,7 @@ else { ...@@ -197,7 +197,7 @@ else {
$vars->{'title_tag'} = "bug_processed"; $vars->{'title_tag'} = "bug_processed";
my ($action, $next_bug); my $action;
if (defined $cgi->param('id')) { if (defined $cgi->param('id')) {
$action = Bugzilla->user->settings->{'post_bug_submit_action'}->{'value'}; $action = Bugzilla->user->settings->{'post_bug_submit_action'}->{'value'};
...@@ -208,16 +208,18 @@ if (defined $cgi->param('id')) { ...@@ -208,16 +208,18 @@ if (defined $cgi->param('id')) {
} }
my $cur = lsearch(\@bug_list, $cgi->param('id')); my $cur = lsearch(\@bug_list, $cgi->param('id'));
if ($cur >= 0 && $cur < $#bug_list) { if ($cur >= 0 && $cur < $#bug_list) {
$next_bug = $bug_list[$cur + 1]; my $next_bug_id = $bug_list[$cur + 1];
# No need to check whether the user can see the bug or not. detaint_natural($next_bug_id);
# All we want is its ID. An error will be thrown later if ($next_bug_id and $user->can_see_bug($next_bug_id)) {
# if the user cannot see it. # We create an object here so that send_results can use it
$vars->{'bug'} = {bug_id => $next_bug}; # when displaying the header.
$vars->{'bug'} = new Bugzilla::Bug($next_bug_id);
}
} }
} }
# Include both action = 'same_bug' and 'nothing'. # Include both action = 'same_bug' and 'nothing'.
else { else {
$vars->{'bug'} = {bug_id => $cgi->param('id')}; $vars->{'bug'} = $first_bug;
} }
} }
else { else {
...@@ -535,7 +537,7 @@ foreach my $b (@bug_objects) { ...@@ -535,7 +537,7 @@ foreach my $b (@bug_objects) {
foreach my $bug (@bug_objects) { foreach my $bug (@bug_objects) {
$dbh->bz_start_transaction(); $dbh->bz_start_transaction();
my $timestamp = $dbh->selectrow_array(q{SELECT NOW()}); my $timestamp = $dbh->selectrow_array(q{SELECT LOCALTIMESTAMP(0)});
my $changes = $bug->update($timestamp); my $changes = $bug->update($timestamp);
my %notify_deps; my %notify_deps;
...@@ -636,31 +638,23 @@ foreach my $bug (@bug_objects) { ...@@ -636,31 +638,23 @@ foreach my $bug (@bug_objects) {
if (Bugzilla->usage_mode == USAGE_MODE_EMAIL) { if (Bugzilla->usage_mode == USAGE_MODE_EMAIL) {
# Do nothing. # Do nothing.
} }
elsif ($action eq 'next_bug') { elsif ($action eq 'next_bug' or $action eq 'same_bug') {
if ($next_bug) { my $bug = $vars->{'bug'};
if (detaint_natural($next_bug) && Bugzilla->user->can_see_bug($next_bug)) { if ($bug and $user->can_see_bug($bug)) {
my $bug = new Bugzilla::Bug($next_bug); if ($action eq 'same_bug') {
ThrowCodeError("bug_error", { bug => $bug }) if $bug->error; # $bug->update() does not update the internal structure of
# the bug sufficiently to display the bug with the new values.
$vars->{'bugs'} = [$bug]; # (That is, if we just passed in the old Bug object, we'd get
$vars->{'nextbug'} = $bug->bug_id; # a lot of old values displayed.)
$bug = new Bugzilla::Bug($bug->id);
$template->process("bug/show.html.tmpl", $vars) $vars->{'bug'} = $bug;
|| ThrowTemplateError($template->error());
exit;
} }
}
} elsif ($action eq 'same_bug') {
if (Bugzilla->user->can_see_bug($cgi->param('id'))) {
my $bug = new Bugzilla::Bug($cgi->param('id'));
ThrowCodeError("bug_error", { bug => $bug }) if $bug->error;
$vars->{'bugs'} = [$bug]; $vars->{'bugs'} = [$bug];
if ($action eq 'next_bug') {
$vars->{'nextbug'} = $bug->id;
}
$template->process("bug/show.html.tmpl", $vars) $template->process("bug/show.html.tmpl", $vars)
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
exit; exit;
} }
} elsif ($action ne 'nothing') { } elsif ($action ne 'nothing') {
......
...@@ -43,8 +43,4 @@ ...@@ -43,8 +43,4 @@
[% title = "Change Votes" %] [% title = "Change Votes" %]
[% END %] [% END %]
[% PROCESS global/header.html.tmpl [% PROCESS global/header.html.tmpl %]
# We don't have a bug object at this point, unfortunately, so we can't
# actually display all the proper header info.
header_addl_info = ''
%]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment