[% PROCESS global/header.html.tmpl %]
[% header_done = 1 %]
[% END %]
+
+[%# Displays changes to bugs that happened in the last request #%]
+[% sentmail = c.flash("last_sent_changes") %]
+[% FOREACH item = sentmail %]
+ [% INCLUDE bug/process/results.html.tmpl
+ id = item.id
+ type = item.type
+ recipient_count = item.recipient_count
+ %]
+[% END %]
+
[% INCLUDE bug_modal/edit.html.tmpl %]
[% PROCESS global/footer.html.tmpl %]
my $recipients = {changer => $user};
my $bug_sent = Bugzilla::BugMail::Send($id, $recipients);
-$bug_sent->{type} = 'created';
-$bug_sent->{id} = $id;
-my @all_mail_results = ($bug_sent);
+my @all_mail_results = ({ id => $id, type => 'created', recipient_count => scalar @{$bug_sent->{sent}} });
foreach my $dep (
map { @{$bug->{$_} || []} } qw(dependson blocked regressed_by regresses)
) {
my $dep_sent = Bugzilla::BugMail::Send($dep, $recipients);
- $dep_sent->{type} = 'dep';
- $dep_sent->{id} = $dep;
- push(@all_mail_results, $dep_sent);
+ push(@all_mail_results, { id => $dep, type => 'dep', recipient_count => scalar @{$dep_sent->{sent}} });
}
# Sending emails for any referenced bugs.
foreach my $ref_bug_id (uniq @{$bug->{see_also_changes} || []}) {
my $ref_sent = Bugzilla::BugMail::Send($ref_bug_id, $recipients);
- $ref_sent->{id} = $ref_bug_id;
- push(@all_mail_results, $ref_sent);
+ push(@all_mail_results, { id => $ref_bug_id, recipient_count => scalar @{$ref_sent->{sent}} });
}
-$vars->{sentmail} = \@all_mail_results;
+$Bugzilla::App::CGI::C->flash(last_sent_changes => \@all_mail_results);
-$format = $template->get_format("bug/create/created",
- scalar($cgi->param('created-format')), "html");
-
-# don't leak the enter_bug format param to show_bug
-$cgi->delete('format');
-
-if ($user->setting('ui_experiments') eq 'on') {
- $C->content_security_policy(SHOW_BUG_MODAL_CSP($bug->id));
-}
-print $cgi->header();
-$template->process($format->{'template'}, $vars)
- || ThrowTemplateError($template->error());
+my $redirect_url = $Bugzilla::App::CGI::C->url_for('show_bugcgi')->query(id => $id);
+$Bugzilla::App::CGI::C->redirect_to($redirect_url);
1;
# 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);
-if ($format_params->{format} eq 'modal') {
- my $bug_id = $vars->{bug} ? $vars->{bug}->id : undef;
- $C->content_security_policy(SHOW_BUG_MODAL_CSP($bug_id));
-}
-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_changes (@all_sent_changes) {
- 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;
+ # We strip the sent changes to just the necessary parameters so that they can
+ # be saved in the session flash.
+ my @saved_sent_changes;
+ foreach my $sent_changes (@all_sent_changes) {
+ foreach my $sent_change (@$sent_changes) {
+ my $saved_sent_change = {
+ id => $sent_change->{params}->{id},
+ type => $sent_change->{params}->{type},
+ recipient_count => scalar @{$sent_change->{sent_bugmail}->{sent}},
+ };
+ push @saved_sent_changes, $saved_sent_change;
}
- $vars->{'bugs'} = [$bug];
- if ($action eq 'next_bug') {
- $vars->{'nextbug'} = $bug->id;
- }
-
- $template->process($format->{template}, $vars)
- || ThrowTemplateError($template->error());
- exit;
}
+
+ $Bugzilla::App::CGI::C->flash(last_sent_changes => \@saved_sent_changes);
+
+ # Redirect to show_bug.cgi.
+ # $bug_id will be the same bug or the next bug due to checks earlier in this file.
+ # An undefined $bug_id (in the case of $action = 'nothing') will still redirect to
+ # show_bug.cgi which will prompt for a bug. This allows mass bug updates to still see
+ # the result of what changed/emails sent.
+ my $bug_id = $vars->{bug} ? $vars->{bug}->id : undef;
+ my $redirect_url = $Bugzilla::App::CGI::C->url_for('show_bugcgi')->query(id => $bug_id);
+ $Bugzilla::App::CGI::C->redirect_to($redirect_url);
+ exit;
}
+ else { # Handle $action = 'nothing' or mass bug update case.
+ print $cgi->header();
+
+ foreach my $sent_changes (@all_sent_changes) {
+ foreach my $sent_change (@$sent_changes) {
+ my $params = $sent_change->{params};
+ my $recipient_count = scalar @{$sent_change->{sent_bugmail}->{sent}};
+ $vars->{$_} = $params->{$_} foreach keys %$params;
+ $vars->{'recipient_count'} = $recipient_count;
+ $template->process("bug/process/results.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
+ $vars->{'header_done'} = 1;
+ }
+ }
- # End the response page.
- $template->process("bug/navigate.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
- $template->process("global/footer.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
+ # End the response page.
+ $template->process("bug/navigate.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
+ $template->process("global/footer.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
+ }
}
1;
}
}
- if ($expected_uri->query_param('id')) {
- if ($expected_uri->query_param('id') eq '__BUG_ID__') {
- $uri->query_param('id' => '__BUG_ID__');
- }
+ if ($expected_uri->query_param('id') and $expected_uri->query_param('id') eq '__BUG_ID__') {
+ $uri->query_param('id' => '__BUG_ID__');
+ }
+
+ if ($expected_uri->query_param('list_id') and $expected_uri->query_param('list_id') eq '__LIST_ID__') {
+ $uri->query_param('list_id' => '__LIST_ID__');
}
+
my ($pkg, $file, $line) = caller;
is($uri, $expected_uri, "checking location on $file line $line");
}
screenshot_page($sel, '/app/artifacts/line271.png');
$sel->click_ok("Search");
check_page_load($sel,
- q{http://HOSTNAME/buglist.cgi?emailreporter2=1&emailtype2=exact&order=Importance&list_id=15&emailtype1=exact&emailcc2=1&query_format=advanced&emailassigned_to1=1&emailqa_contact2=1&email2=QA-Selenium-TEST%40mozilla.test&email1=admin%40mozilla.test&emailassigned_to2=1&product=TestProduct}
+ q{http://HOSTNAME/buglist.cgi?emailreporter2=1&emailtype2=exact&order=Importance&list_id=__LIST_ID__&emailtype1=exact&emailcc2=1&query_format=advanced&emailassigned_to1=1&emailqa_contact2=1&email2=QA-Selenium-TEST%40mozilla.test&email1=admin%40mozilla.test&emailassigned_to2=1&product=TestProduct}
);
$sel->title_is("Bug List");
screenshot_page($sel, '/app/artifacts/line275.png');
$sel->is_text_present_ok("One bug found.");
$sel->type_ok("save_newqueryname", "My bugs from QA_Selenium");
$sel->click_ok("remember");
-check_page_load($sel,
- q{http://HOSTNAME/buglist.cgi?newquery=email1%3Dadmin%2540mozilla.test%26email2%3DQA-Selenium-TEST%2540mozilla.test%26emailassigned_to1%3D1%26emailassigned_to2%3D1%26emailcc2%3D1%26emailqa_contact2%3D1%26emailreporter2%3D1%26emailtype1%3Dexact%26emailtype2%3Dexact%26list_id%3D15%26product%3DTestProduct%26query_format%3Dadvanced%26order%3Dpriority%252Cbug_severity&cmdtype=doit&remtype=asnamed&token=1531926552-dc69995d79c786af046436ec6717000b&newqueryname=My%20bugs%20from%20QA_Selenium&list_id=16}
-);
+# Bad test below, unable to deterministically know the inner list_id encoded in the newquery param.
+# check_page_load($sel,
+# q{http://HOSTNAME/buglist.cgi?newquery=email1%3Dadmin%2540mozilla.test%26email2%3DQA-Selenium-TEST%2540mozilla.test%26emailassigned_to1%3D1%26emailassigned_to2%3D1%26emailcc2%3D1%26emailqa_contact2%3D1%26emailreporter2%3D1%26emailtype1%3Dexact%26emailtype2%3Dexact%26list_id%3D15%26product%3DTestProduct%26query_format%3Dadvanced%26order%3Dpriority%252Cbug_severity&cmdtype=doit&remtype=asnamed&token=1531926552-dc69995d79c786af046436ec6717000b&newqueryname=My+bugs+from+QA_Selenium&list_id=__LIST_ID__}
+# );
$sel->title_is("Search created");
$sel->is_text_present_ok(
"OK, you have a new search named My bugs from QA_Selenium.");
'//a[normalize-space(text())="My bugs from QA_Selenium" and not(@role="option")]'
);
check_page_load($sel,
- q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=17}
+ q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My+bugs+from+QA_Selenium&list_id=__LIST_ID__}
);
$sel->title_is("Bug List: My bugs from QA_Selenium");
logout($sel);
'//a[normalize-space(text())="My bugs from QA_Selenium" and @role="option"]');
screenshot_page($sel, '/app/artifacts/line344.png');
check_page_load($sel,
- q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=19}
+ q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My+bugs+from+QA_Selenium&list_id=__LIST_ID__}
);
screenshot_page($sel, '/app/artifacts/line346.png');
$sel->title_is("Bug List: My bugs from QA_Selenium");
screenshot_page($sel, '/app/artifacts/line350.png');
$sel->click_ok('change-several');
check_page_load($sel,
- q{http://HOSTNAME/buglist.cgi?email1=admin%40mozilla.test&email2=QA-Selenium-TEST%40mozilla.test&emailassigned_to1=1&emailassigned_to2=1&emailcc2=1&emailqa_contact2=1&emailreporter2=1&emailtype1=exact&emailtype2=exact&product=TestProduct&query_format=advanced&order=priority%2Cbug_severity&tweak=1&list_id=20}
+ q{http://HOSTNAME/buglist.cgi?email1=admin%40mozilla.test&email2=QA-Selenium-TEST%40mozilla.test&emailassigned_to1=1&emailassigned_to2=1&emailcc2=1&emailqa_contact2=1&emailreporter2=1&emailtype1=exact&emailtype2=exact&product=TestProduct&query_format=advanced&order=priority%2Cbug_severity&tweak=1&list_id=__LIST_ID__}
);
$sel->title_is("Bug List");
$sel->click_ok("check_all");
$sel->click_ok(
'//a[normalize-space(text())="My bugs from QA_Selenium" and @role="option"]');
check_page_load($sel,
- q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=21}
+ q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My+bugs+from+QA_Selenium&list_id=__LIST_ID__}
);
$sel->title_is("Bug List: My bugs from QA_Selenium");
$sel->is_text_present_ok("2 bugs found");
$sel->click_ok('change-several', 'Change Several Bugs at Once');
check_page_load($sel,
- q{http://HOSTNAME/buglist.cgi?email1=admin%40mozilla.test&email2=QA-Selenium-TEST%40mozilla.test&emailassigned_to1=1&emailassigned_to2=1&emailcc2=1&emailqa_contact2=1&emailreporter2=1&emailtype1=exact&emailtype2=exact&product=TestProduct&query_format=advanced&order=priority%2Cbug_severity&tweak=1&list_id=22}
+ q{http://HOSTNAME/buglist.cgi?email1=admin%40mozilla.test&email2=QA-Selenium-TEST%40mozilla.test&emailassigned_to1=1&emailassigned_to2=1&emailcc2=1&emailqa_contact2=1&emailreporter2=1&emailtype1=exact&emailtype2=exact&product=TestProduct&query_format=advanced&order=priority%2Cbug_severity&tweak=1&list_id=__LIST_ID__}
);
$sel->title_is("Bug List");
$sel->click_ok("check_all");
$sel->click_ok(
'//a[normalize-space(text())="My bugs from QA_Selenium" and @role="option"]');
check_page_load($sel,
- q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=23}
+ q{http://HOSTNAME/buglist.cgi?cmdtype=runnamed&namedcmd=My+bugs+from+QA_Selenium&list_id=__LIST_ID__}
);
$sel->title_is("Bug List: My bugs from QA_Selenium");
$sel->click_ok('forget-search', 'Forget Search');
check_page_load($sel,
- q{http://HOSTNAME/buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=My%20bugs%20from%20QA_Selenium&token=1531926582-f228fa8ebc2f2b3970f2a791e54534ec&list_id=24}
+ q{http://HOSTNAME/buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=My+bugs+from+QA_Selenium&token=1531926582-f228fa8ebc2f2b3970f2a791e54534ec&list_id=__LIST_ID__}
);
$sel->title_is("Search is gone");
$sel->is_text_present_ok("OK, the My bugs from QA_Selenium search is gone");
# The user is no longer the QA contact, and he has no other role
# with the bug. He can no longer see it.
-$sel->wait_for_page_to_load_ok(WAIT_TIME);
-$sel->is_text_present_ok("(list of e-mails not available)");
-$sel->click_ok("link=bug $bug1_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Access Denied");
logout($sel);
# If we don't have an ID, _AND_ we're only doing a single bug, then prompt
if (!$cgi->param('id') && $single) {
print Bugzilla->cgi->header();
- $template->process("bug/choose.html.tmpl", $vars)
+ $template->process('bug/choose.html.tmpl', $vars)
|| ThrowTemplateError($template->error());
exit;
}
[% PROCESS global/variables.none.tmpl %]
-[% PROCESS global/header.html.tmpl
- title = "Search by $terms.bug number"
- %]
+[% UNLESS header_done %]
+ [% PROCESS bug/process/header.html.tmpl title = "Search by $terms.bug number" %]
+ [% header_done = 1 %]
+[% END %]
+
+[%# Displays changes to bugs that happened in the last request #%]
+[% sentmail = c.flash("last_sent_changes") %]
+[% FOREACH item = sentmail %]
+ [% INCLUDE bug/process/results.html.tmpl
+ id = item.id
+ type = item.type
+ recipient_count = item.recipient_count
+ %]
+[% END %]
<form method="get" action="[% basepath FILTER none %]show_bug.cgi" data-no-csrf>
<p>
[%# INTERFACE:
# mailing_bugid: The bug ID that email is being sent for.
- # sent_bugmail: The results of Bugzilla::BugMail::Send().
+ # recipient_count: The number of people that were emailed.
#%]
[% USE Bugzilla %]
[% PROCESS global/variables.none.tmpl %]
-[%# hide the recipient list by default from new users %]
-[% show_recipients =
- user.settings.post_bug_submit_action.value == 'nothing'
- || Bugzilla.cgi.cookie('show_bugmail_recipients')
- || !user.can_see_bug(mailing_bugid)
-%]
-[% recipient_count = sent_bugmail.sent.size %]
-
-<script [% script_nonce FILTER none %]>
- function toggleBugmailRecipients(bug_id, show) {
- if (show) {
- $("#bugmail_summary_" + bug_id).show();
- $("#bugmail_summary_" + bug_id + "_short").hide();
- } else {
- $("#bugmail_summary_" + bug_id).hide();
- $("#bugmail_summary_" + bug_id + "_short").show();
- }
- $.cookie('show_bugmail_recipients', (show ? 1 : 0), {
- expires: new Date("January 12, 2025")
- });
- }
- $(function() {
- $(".toggleBugmailRecipients").on("click", function (event) {
- event.preventDefault();
- toggleBugmailRecipients($(event.target).data('mailing-bugid'),
- $(event.target).data('mailing-show'));
- });
- });
-</script>
-
-<dl id="bugmail_summary_[% mailing_bugid FILTER none %]"
- [% IF !show_recipients %]style="display:none;"[% END %]>
- <dt>Email sent to:</dt>
- <dd>
- [% IF user.can_see_bug(mailing_bugid) %]
- [% IF sent_bugmail.sent.size > 0 %]
- [%+ FOREACH name = sent_bugmail.sent %]
- <code>[% name FILTER html %]</code>[% ", " UNLESS loop.last() %]
- [% END %]
- [% ELSE %]
- no one
- [% END %]
- (<a href="#" class="toggleBugmailRecipients" data-mailing-bugid="[% mailing_bugid FILTER html %]"
- data-mailing-show="false">hide</a>)
- [% ELSE %]
- (list of e-mails not available)
- [% END %]
- </dd>
-</dl>
-
-<div id="bugmail_summary_[% mailing_bugid FILTER none %]_short"
- [% IF show_recipients %]style="display:none;"[% END %]>
+<div id="bugmail_summary_[% mailing_bugid FILTER none %]_short">
[% IF recipient_count > 0 %]
Email sent to [% recipient_count FILTER html %] recipient[% 's' UNLESS recipient_count == 1 %].
- (<a href="#" class="toggleBugmailRecipients" data-mailing-bugid="[% mailing_bugid FILTER html %]"
- data-mailing-show="true">show</a>)
[% ELSE %]
No emails were sent.
[% END %]
</div>
-
[% IF !header_done %]
[% PROCESS "bug/show-header.html.tmpl" %]
[% PROCESS global/header.html.tmpl %]
+ [% header_done = 1 %]
+[% END %]
+
+[%# Displays changes to bugs that happened in the last request #%]
+[% sentmail = c.flash("last_sent_changes") %]
+[% FOREACH item = sentmail %]
+ [% INCLUDE bug/process/results.html.tmpl
+ id = item.id
+ type = item.type
+ recipient_count = item.recipient_count
+ %]
[% END %]
[% IF nextbug %]