From 6b77c44126de41e71cf80e66c65b9bf94b78c69e Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 14 Dec 2016 12:44:54 -0500 Subject: [PATCH 1/7] Bug 1323244 - Make the link to Mozilla Community Participation Guidelines not participate in keyboard navigation; r=dkl --- .../template/en/default/bug_modal/new_comment.html.tmpl | 2 +- template/en/default/bug/comment.html.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/BugModal/template/en/default/bug_modal/new_comment.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/new_comment.html.tmpl index 424cec3019..e76e422bce 100644 --- a/extensions/BugModal/template/en/default/bug_modal/new_comment.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/new_comment.html.tmpl @@ -49,7 +49,7 @@
- + Comments Subject to Etiquette and Contributor Guidelines
diff --git a/template/en/default/bug/comment.html.tmpl b/template/en/default/bug/comment.html.tmpl index 46747cd1a7..e3cd382fdf 100644 --- a/template/en/default/bug/comment.html.tmpl +++ b/template/en/default/bug/comment.html.tmpl @@ -13,7 +13,7 @@ #%]
- + Comments Subject to Etiquette and Contributor Guidelines
From 9f141e825ed983fd2540bbfadb4be693ddce16a5 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 14 Dec 2016 23:31:37 +0000 Subject: [PATCH 2/7] Bug 1323595 - Update to form for Recruiting Product --- .../default/bug/create/cost-centers.none.tmpl | 54 +++++++------------ 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/extensions/BMO/template/en/default/bug/create/cost-centers.none.tmpl b/extensions/BMO/template/en/default/bug/create/cost-centers.none.tmpl index 38356c8300..1db92c8348 100644 --- a/extensions/BMO/template/en/default/bug/create/cost-centers.none.tmpl +++ b/extensions/BMO/template/en/default/bug/create/cost-centers.none.tmpl @@ -13,11 +13,10 @@ "1002 - Participation" "1003 - Office of CIO" "1005 - Corp Consolidation & Elimination" - "1006 - The Development Center" - "1010 - Office of CTO" + "1006 - Taipei Development Center" + "1010 - Emerging Technologies" "1011 - Research" "1012 - Tech Evangelism" - "1013 - Advanced Technology Lab" "1014 - Technology Strategy" "1020 - Chief of Staff" "1100 - Policy" @@ -31,16 +30,12 @@ "1320 - People Operations" "1340 - People" "1350 - Recruiting" - "1360 - Metrics" + "1370 - Organization Strategy" "1400 - IT and Network" - "1410 - Infrastructure Eng & Ops (Infra)" + "1410 - Infrastructure Eng and Ops (Infra)" "1420 - Enterprise Information Security (EIS)" "1430 - End User Services (EUS)" - "1440 - Enterprise Applications & Services (EApps)" - "1500 - General Content Services" - "1501 - Engineering" - "1502 - Sales" - "1503 - Product" + "1440 - Enterprise Applications and Services (EApps)" "2000 - General Marketing" "2200 - Mar Com" "2300 - Lifecycle Marketing" @@ -48,36 +43,25 @@ "2400 - Brand Engagement" "2500 - Marketing Operations" "2700 - Product Marketing" + "5000 - Firefox" + "5010 - Advanced Technology" "5500 - Product Engineering" + "5510 - Firefox Platform Engineering" "5650 - Services Engineering" + "5660 - Production Cloud Infrastructure" + "5670 - Development Cloud Infrastructure" + "5680 - Firefox Platform Operations" "5700 - Firefox UX" - "5000 - Firefox" "5800 - Product Management" "5900 - Program Management" - "5660 - Production Cloud Infrastructure" - "5670 - Development Cloud Infrastructure" - "6000 - Mobile" - "6110 - Firefox OS Engineering I" - "6140 - Firefox OS Automation" - "6150 - Firefox OS Engineering Program Management" - "6160 - Firefox OS QA" - "6200 - Firefox OS Product Management" - "6220 - Firefox OS Product Marketing" - "6300 - Firefox OS UX" - "6500 - Mobile Business Development" - "7000 - Mobile Planning and Ecosystem" - "7110 - Mobile Partner Engineering" - "7120 - Mobile Planning" - "7130 - Mobile Apps Engineering" - "7150 - Mobile Partners Contents" - "7200 - Mobile Ecosystem Program Management" - "7220 - Mobile Partner Products" - "7500 - Reviews and Community" - "8000 - Engineering Platform" - "8200 - Platform Operations" - "8750 - Localization (l10n)" - "8800 - Product Management" - "8900 - Platform Engineering" + "6000 - Connected Devices" + "6110 - Connected Devices Engineering" + "6150 - Connected Devices Program Management" + "6200 - Connected Devices Product Management" + "6600 - Connected Devices Strategy and Insights" + "6650 - Connected Devices Design" + "6700 - Connected Devices Business Operations" + "6750 - Connected Devices Product/UX" "900 - Mozilla Foundation" "901 - MoFo NSF" ]; From 490499f9a35b36b72c0b7b30322b9838774b93fe Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 14 Dec 2016 18:49:48 -0500 Subject: [PATCH 3/7] Bug 1313766 - Bugzilla::Bug->send_changes() should not output HTML directly --- Bugzilla/Bug.pm | 52 ++++----- Bugzilla/Error/Template.pm | 26 +++++ process_bug.cgi | 104 +++++++++++------- .../en/default/bug/process/bugmail.html.tmpl | 4 +- 4 files changed, 115 insertions(+), 71 deletions(-) create mode 100644 Bugzilla/Error/Template.pm diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 69734e6c04..637d941145 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1331,13 +1331,13 @@ sub remove_from_db { ##################################################################### sub send_changes { - my ($self, $changes, $vars) = @_; - + my ($self, $changes) = @_; + my @results; my $user = Bugzilla->user; - my $old_qa = $changes->{'qa_contact'} + my $old_qa = $changes->{'qa_contact'} ? $changes->{'qa_contact'}->[0] : ''; - my $old_own = $changes->{'assigned_to'} + my $old_own = $changes->{'assigned_to'} ? $changes->{'assigned_to'}->[0] : ''; my $old_cc = $changes->{cc} ? $changes->{cc}->[0] : ''; @@ -1349,15 +1349,15 @@ sub send_changes { changer => $user, ); - my $recipient_count = _send_bugmail( - { id => $self->id, type => 'bug', forced => \%forced }, $vars); + push @results, _send_bugmail( + { id => $self->id, type => 'bug', forced => \%forced }); # If the bug was marked as a duplicate, we need to notify users on the # other bug of any changes to that bug. my $new_dup_id = $changes->{'dup_id'} ? $changes->{'dup_id'}->[1] : undef; if ($new_dup_id) { - $recipient_count += _send_bugmail( - { forced => { changer => $user }, type => "dupe", id => $new_dup_id }, $vars); + push @results, _send_bugmail( + { forced => { changer => $user }, type => "dupe", id => $new_dup_id }); } # If there were changes in dependencies, we need to notify those @@ -1376,7 +1376,7 @@ sub send_changes { foreach my $id (@{ $self->blocked }) { $params->{id} = $id; - $recipient_count += _send_bugmail($params, $vars); + push @results, _send_bugmail($params); } } } @@ -1394,37 +1394,28 @@ sub send_changes { delete $changed_deps{''}; foreach my $id (sort { $a <=> $b } (keys %changed_deps)) { - $recipient_count += _send_bugmail( - { forced => { changer => $user }, type => "dep", id => $id }, $vars); + push @results, _send_bugmail( + { forced => { changer => $user }, type => "dep", id => $id }); } # Sending emails for the referenced bugs. foreach my $ref_bug_id (uniq @{ $self->{see_also_changes} || [] }) { - $recipient_count += _send_bugmail( - { forced => { changer => $user }, id => $ref_bug_id }, $vars); + push @results, _send_bugmail( + { forced => { changer => $user }, id => $ref_bug_id }); } - return $recipient_count; + return \@results; } sub _send_bugmail { - my ($params, $vars) = @_; + my ($params) = @_; require Bugzilla::BugMail; - my $results = + my $sent_bugmail = Bugzilla::BugMail::Send($params->{'id'}, $params->{'forced'}, $params); - if (Bugzilla->usage_mode == USAGE_MODE_BROWSER) { - my $template = Bugzilla->template; - $vars->{$_} = $params->{$_} foreach keys %$params; - $vars->{'sent_bugmail'} = $results; - $template->process("bug/process/results.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - $vars->{'header_done'} = 1; - } - - return scalar @{ $results->{sent} }; + return { params => $params, sent_bugmail => $sent_bugmail }; } ##################################################################### @@ -2778,10 +2769,11 @@ sub _set_product { if (%vars) { $vars{product} = $product; $vars{bug} = $self; - my $template = Bugzilla->template; - $template->process("bug/process/verify-new-product.html.tmpl", - \%vars) || ThrowTemplateError($template->error()); - exit; + require Bugzilla::Error::Template; + die Bugzilla::Error::Template->new( + file => "bug/process/verify-new-product.html.tmpl", + vars => \%vars + ); } } else { diff --git a/Bugzilla/Error/Template.pm b/Bugzilla/Error/Template.pm new file mode 100644 index 0000000000..a3afa7e4d9 --- /dev/null +++ b/Bugzilla/Error/Template.pm @@ -0,0 +1,26 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::Error::Template; + +use 5.10.1; +use strict; +use warnings; +use Moo; + +has 'file' => ( + is => 'ro', + required => 1, +); + +has 'vars' => ( + is => 'ro', + default => sub { {} }, +); + + +1; \ No newline at end of file diff --git a/process_bug.cgi b/process_bug.cgi index 80018cfb30..f97d02b282 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -27,6 +27,7 @@ use Bugzilla::Status; use Bugzilla::Token; use Bugzilla::Hook; +use Scalar::Util qw(blessed); use List::MoreUtils qw(firstidx); use Storable qw(dclone); @@ -111,8 +112,6 @@ 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') || ''; @@ -158,6 +157,7 @@ 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; @@ -186,6 +186,9 @@ $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); @@ -361,7 +364,21 @@ foreach my $b (@bug_objects) { push(@remove_groups, $g->name) if grep { $_ eq $g->name } @unchecked_groups; } local $set_all_fields{groups}->{remove} = \@remove_groups; - $b->set_all(\%set_all_fields); + my $ok = eval { + $b->set_all(\%set_all_fields); + 1; + }; + unless ($ok) { + my $error = $@; + if (blessed $error && $error->isa('Bugzilla::Error::Template')) { + print $cgi->header(); + $template->process($error->file, $error->vars); + exit; + } + else { + die $error; + } + } } if (defined $cgi->param('id')) { @@ -376,6 +393,7 @@ if (defined $cgi->param('id')) { ############################## # Do Actual Database Updates # ############################## +my $sent_changes; foreach my $bug (@bug_objects) { my $changes = $bug->update(); @@ -389,50 +407,58 @@ foreach my $bug (@bug_objects) { } } - my $recipient_count = $bug->send_changes($changes, $vars); + $sent_changes = $bug->send_changes($changes); } # Delete the session token used for the mass-change. delete_token($token) unless $cgi->param('id'); -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}); + +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; + } - # 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; + $template->process($format->{template}, $vars) + || ThrowTemplateError($template->error()); + exit; + } } -} elsif ($action ne 'nothing') { - ThrowCodeError("invalid_post_bug_submit_action"); -} -# End the response page. -unless (Bugzilla->usage_mode == USAGE_MODE_EMAIL) { + # End the response page. $template->process("bug/navigate.html.tmpl", $vars) || ThrowTemplateError($template->error()); $template->process("global/footer.html.tmpl", $vars) diff --git a/template/en/default/bug/process/bugmail.html.tmpl b/template/en/default/bug/process/bugmail.html.tmpl index 21e4ff7b74..0c4f2f27d9 100644 --- a/template/en/default/bug/process/bugmail.html.tmpl +++ b/template/en/default/bug/process/bugmail.html.tmpl @@ -24,13 +24,13 @@ # sent_bugmail: The results of Bugzilla::BugMail::Send(). #%] -[% USE CGI %] +[% 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' - || CGI.cookie('show_bugmail_recipients') + || Bugzilla.cgi.cookie('show_bugmail_recipients') || !user.can_see_bug(mailing_bugid) %] [% recipient_count = sent_bugmail.sent.size %] From d3a4b61eb5dd790604f5e02675a1e9358002ffca Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 15 Dec 2016 18:51:24 +0000 Subject: [PATCH 4/7] Bug 1322271 - Tooltip for "Priority" field should explain that P1 is highest priority etc --- template/en/default/bug/field-help.none.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/template/en/default/bug/field-help.none.tmpl b/template/en/default/bug/field-help.none.tmpl index 9985e41725..d52d598eb8 100644 --- a/template/en/default/bug/field-help.none.tmpl +++ b/template/en/default/bug/field-help.none.tmpl @@ -109,7 +109,8 @@ percentage_complete => $vars.field_descs.work_time to its ${vars.field_descs.estimated_time}.", priority => - "Engineers prioritize their $terms.bugs using this field.", + "Engineers prioritize their $terms.bugs using this field. + P1 being of the highest priority.", # Note that this has extra text added below if useclassification is on. product => From 50fe01e3ee89cd9395dc21a739b8bc74b5c54272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emma=20Humphries=20=E2=98=95=EF=B8=8F=20+needinfo=20me?= Date: Fri, 16 Dec 2016 04:47:46 +0000 Subject: [PATCH 5/7] Bug 1321592 - Update Bugzilla Etiquette and add Abuse Policy --- .../en/default/account/create.html.tmpl | 113 ++++++++------ .../en/default/pages/anti-abuse.html.tmpl | 58 +++++++ .../en/default/pages/etiquette.html.tmpl | 143 +++++++----------- template/en/default/index.html.tmpl | 3 + 4 files changed, 186 insertions(+), 131 deletions(-) create mode 100644 extensions/BMO/template/en/default/pages/anti-abuse.html.tmpl diff --git a/extensions/BMO/template/en/default/account/create.html.tmpl b/extensions/BMO/template/en/default/account/create.html.tmpl index 3a4dd8a70e..42070fe02f 100644 --- a/extensions/BMO/template/en/default/account/create.html.tmpl +++ b/extensions/BMO/template/en/default/account/create.html.tmpl @@ -17,11 +17,12 @@ # # Contributor(s): Gervase Markham # Byron Jones + # Emma Humphries #%] [%# INTERFACE # none - # + # # Param("maintainer") is used to display the maintainer's email. # Param("emailsuffix") is used to pre-fill the email field. #%] @@ -40,11 +41,12 @@ @@ -110,52 +119,69 @@ function onSubmit() {

I want to help

-

- Great! There are three things to know and do: -

-
    -
  1. - Please consider reading our - [% terms.bug %]-writing guidelines. -
  2. -
  3. - [% terms.Bugzilla %] is a public place. Your comments and other activities - on [% terms.bugs %] will generally be publicly visible, and your email address will be - accessible through public APIs and will be visible to all logged-in users - of [% terms.Bugzilla %]. Some people use an - alternative email address for this reason. - See Mozilla's Websites, Communications & Cookies Privacy Notice for - more information on our privacy policies. -
  4. -
  5. - When using [% terms.Bugzilla %] to submit patches, comments, code, and any other content, - you agree to our policies on open source licensing and content submission. See Mozilla’s - Websites - and Communications Terms of Use for more information. -
  6. -
  7. - Please give us an email address you want to use. Once we confirm that it works, - you'll be asked to set a password and then you can start filing [% terms.bugs %] and helping fix them. -
  8. -
+

+ Great! There are five things to know and do: +

+
    +
  1. + Please read our + [% terms.bug %]-writing guidelines. +
  2. +
  3. + [% terms.Bugzilla %] is a public place. Your comments and other activities + on [% terms.bugs %] will generally be publicly visible, and your email address will be + accessible through public APIs and will be visible to all logged-in users + of [% terms.Bugzilla %]. Some people use an + alternative email address for this reason. + See Mozilla's Websites, Communications & Cookies Privacy Notice for + more information on our privacy policies. +
  4. +
  5. + When using [% terms.Bugzilla %] to submit patches, comments, code, and any other content, + you agree to our policies on open source licensing and content submission. See Mozilla’s + Websites + and Communications Terms of Use for more information. +
  6. +
  7. + Your understand that your conduct on this site is subject to both [% terms.Bugzilla %] etiquette, + and Mozilla's participation guidelines, + and in turn are governed by our anti-abuse policy. By creating an account, + you agree to abide by them. +
  8. +
  9. + Please give us an email address you want to use. Once we confirm that it works, + you'll be asked to set a password and then you can start filing [% terms.bugs %] and helping fix them. +
  10. +

Create an account

- - - - - - -
Email Address: - [% Param('emailsuffix') FILTER html %] - - -
+ + + + + +
Email Address: + [% Param('emailsuffix') FILTER html %] +
+ + + + + +
+ I have read [% terms.Bugzilla %] etiquette + and Mozilla's participation guidelines + and agree to abide by them, and + I acknowledge, and have read the anti-abuse policy. +
+
+ +
[% Hook.process('additional_methods') %] @@ -186,4 +212,3 @@ function onSubmit() { [% END %] - diff --git a/extensions/BMO/template/en/default/pages/anti-abuse.html.tmpl b/extensions/BMO/template/en/default/pages/anti-abuse.html.tmpl new file mode 100644 index 0000000000..7d3bcad4b2 --- /dev/null +++ b/extensions/BMO/template/en/default/pages/anti-abuse.html.tmpl @@ -0,0 +1,58 @@ + +[%# This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # + # This Source Code Form is "Incompatible With Secondary Licenses", as + # defined by the Mozilla Public License, v. 2.0. + #%] + +[% PROCESS global/header.html.tmpl + title = "Bugzilla Anti-Abuse Policy" + style = "li { margin: 5px } .heading { font-weight: bold }" %] + +

Anti-Abuse Policy

+ +

+ It is our intention that [% terms.Bugzilla %] remains a useful tool for reporting + and commenting on [% terms.bugs %], feature-requests and tasks for the Mozilla community. +

+ +

+ In order to keep [% terms.Bugzilla %] a useful, inclusive place for this work, we have + guidelines + for using this site which, by using this site, you agree to follow. +

+ +
    +
  • + If you find a [% terms.Bugzilla %] user violating or guidelines + or Mozilla's participation guidelines + in comments on [% terms.bugs %], please tag the comments + in question so that an administrator can review them. +
  • +
  • + If a comment is abusive or threatening use the tag admin. An admin will + receive a notification shortly and be able to follow up. [% terms.Bugs %] with comments marked 'spam', + and 'advocacy' will also be reviewed. +
  • +
  • + If a [% terms.bug %]'s short-description or whiteboard tags violate our guidelines, + please describe the issue in a comment and tag it admin. +
  • +
  • + If another [% terms.Bugzilla %] user asks you to stop a behavior, stop doing it. + If an administrator asks you to stop engaging in a behavior, do it. Administrators + have the discretion to limit or suspend your account, and take further actions + if necessary if you violate our guidelines. +
  • +
+ +

+ Questions about this policy should be addressed to + bugzilla-admin@mozilla.org. + If you need to contact a [% terms.Bugzilla %] community administrator immediately, + please contact an administrator in the #bmo channel on irc.mozilla.org. +

+ +[% INCLUDE global/footer.html.tmpl %] diff --git a/extensions/BMO/template/en/default/pages/etiquette.html.tmpl b/extensions/BMO/template/en/default/pages/etiquette.html.tmpl index ad913bd9e1..282c0c2ed4 100644 --- a/extensions/BMO/template/en/default/pages/etiquette.html.tmpl +++ b/extensions/BMO/template/en/default/pages/etiquette.html.tmpl @@ -18,129 +18,98 @@ # # Contributor(s): Stefan Seifert # Gervase Markham + # Emma Humphries #%] [% PROCESS global/header.html.tmpl title = "Bugzilla Etiquette" style = "li { margin: 5px } .heading { font-weight: bold }" %] -

- There's a number of faux pas you can commit when using - [%+ terms.Bugzilla %]. At the very - least, these will make Mozilla contributors upset at you; if committed enough - times they will cause those contributors to demand the disabling of your - [%+ terms.Bugzilla %] account. So, ignore this advice at your peril. -

- -

- - Please also read the Mozilla Community Participation Guidelines -

+

Bugzilla Etiquette

- That said, Mozilla developers are generally a friendly bunch, and will be - friendly towards you as long as you follow these guidelines. + It is our intention that [% terms.Bugzilla %] remains a useful tool for reporting + and commenting on [% terms.bugs %], feature-requests, and tasks for the Mozilla community. + In order to keep [%+ terms.Bugzilla %] a useful, inclusive place for this work, we have + guidelines for using this site which, by using this site, you agree to follow. + In addition, your participation on this site is also subject to + Mozilla's participation guidelines. + Violations of [% terms.Bugzilla %] etiquette or Mozilla's participation guidelines will be considered + as grounds for suspending your privileges on this site, or suspend your account altogether.

-

1. Commenting

- -

- This is the most important section. -

+

Commenting

  1. - No pointless comments. - Unless you have something constructive and helpful to say, do not add a - comment to a [% terms.bug %]. In [% terms.bugs %] where there is a heated debate going on, you - should be even more - inclined not to add a comment. Unless you have something new to contribute, - then the [% terms.bug %] owner is aware of all the issues, and will make a judgement - as to what to do. If you agree the [% terms.bug %] should be fixed, vote for it. - Additional "I see this too" or "It works for me" comments are unnecessary - unless they are on a different platform or a significantly different build. - Constructive and helpful thoughts unrelated to the topic of the [% terms.bug %] - should go in the appropriate - newsgroup. + No abusing people. + Constant and intense critique is one of the reasons we build great products. + It's harder to fall into group-think if there is always a healthy amount of + dissent. We want to encourage vibrant debate inside of the Mozilla + community, we want you to disagree with us, and we want you to effectively + argue your case. However, we require that in the process, you criticize + things, not people. Examples of things include: interfaces, + algorithms, and schedules. Examples of people include: developers, + designers and users. Attacking or encouraging attacks on a person + may result in you being banned from [% terms.Bugzilla %]. +
  2. + +
  3. + No obligation. + "Open Source" is not the same as "the developers must do my bidding." + Everyone here wants to help, but no one else has any obligation to fix + the [% terms.bugs %] you want fixed. Therefore, you should not act as if you + expect someone to fix a [% terms.bug %] by a particular date or release. + Aggressive or repeated demands will not be received well and will almost + certainly diminish the impact and interest in your suggestions.
  4. - No obligation. - "Open Source" is not the same as "the developers must do my bidding." - Everyone here wants to help, but no one else has any obligation to fix - the [% terms.bugs %] you want fixed. Therefore, you should not act as if you - expect someone to fix a [% terms.bug %] by a particular date or release. - Aggressive or repeated demands will not be received well and will almost - certainly diminish the impact and interest in your suggestions. + No spam. + Posting comment spam will lead to the supsension of your account.
  5. - No abusing people. - Constant and intense critique is one of the reasons we build great products. - It's harder to fall into group-think if there is always a healthy amount of - dissent. We want to encourage vibrant debate inside of the Mozilla - community, we want you to disagree with us, and we want you to effectively - argue your case. However, we require that in the process, you attack - things, not people. Examples of things include: interfaces, - algorithms, and schedules. Examples of people include: developers, - designers and users. Attacking a person may result in you being banned - from [% terms.Bugzilla %]. + No pointless comments. + Limit comments on a [% terms.bug %] to information which will help with + resolving it. Unless requested, additional "I see this too" or "It works for me" + comments are unnecessary unless they are on a different platform or a significantly + different build.
  6. - No private email. - Unless the [% terms.bug %] owner or another respected project contributor has asked you - to email them with specific information, please place all information - relating to [% terms.bugs %] - in the [% terms.bug %] itself. Do not send them by private email; no-one else can read - them if you do that, and they'll probably just get ignored. If a file - is too big for [% terms.Bugzilla %], add a comment giving the file size and contents - and ask what to do. + No private email. + Do not send comments to [% terms.bugs %] by private email; no-one else can read + them if you do that, and they'll be missed and/or ignored. If an attachment + is too big for [% terms.Bugzilla %], add a comment giving the file size and contents + and ask what to do.
-

2. Changing Fields

+

Changing Fields

  1. - No messing with other people's [% terms.bugs %]. - Unless you are the [% terms.bug %] assignee, or have some say over the use of their - time, never change the Priority or Target Milestone fields. If in doubt, - do not change the fields of [% terms.bugs %] you do not own - add a comment - instead, suggesting the change. + No messing with other people's [% terms.bugs %]. + Unless you are the [% terms.bug %] assignee, or have some say over the use of their + time, never change the Priority or Target Milestone fields. If in doubt, + do not change the fields of [% terms.bugs %] you do not own - add a comment + instead, suggesting the change.
  2. - No whining about decisions. - If a respected project contributor has marked a [% terms.bug %] as INVALID, then it is - invalid. Someone filing another duplicate of it does not change this. Unless - you have further important evidence, do not post a comment arguing that an - INVALID or WONTFIX [% terms.bug %] should be reopened. + No whining about decisions. + If another project contributor has marked a [% terms.bug %] as INVALID, then it is + invalid. Filing another duplicate of it does not change this. Unless + you have further evidence to support this, do not post a comment arguing that an + INVALID or WONTFIX [% terms.bug %] should be reopened.
-

3. Applicability

- -
    -
  1. - Some of these rules may not apply to you. If they do not, you will know - exactly which ones do not, and why they do not apply. If you are not - sure, then they definitely all apply to you. -
  2. -
- -

- If you see someone not following these rules, the first step is, as an exception - to guideline 1.4, to make them aware of this document by private mail. - Flaming people publically in [% terms.bugs %] violates guidelines 1.1 and 1.3. In the case of - persistent offending you should ping an administrator on Mozilla IRC in channel #bmo and ask them - to look into it. -

-

- This entire document can be summed up in one sentence: - do unto others as you would have them do unto you. + If you observe, or are the subject of behavior in violation of these guidelines, please tag + the [% terms.bug %] or comment following our anti-abuse policy.

diff --git a/template/en/default/index.html.tmpl b/template/en/default/index.html.tmpl index f99287d49f..c4436b53fa 100644 --- a/template/en/default/index.html.tmpl +++ b/template/en/default/index.html.tmpl @@ -85,6 +85,9 @@ function checkQuicksearch( form ) {

  • [%- terms.Bugzilla %] Etiquette
  • +
  • + | Anti-Abuse Policy +
  • | [%- terms.Bug %] Writing Guidelines
  • From e0040665d073cb044bcee0aac730d8fca175d852 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Fri, 16 Dec 2016 15:44:19 -0500 Subject: [PATCH 6/7] Revert "Bug 1313766 - Bugzilla::Bug->send_changes() should not output HTML directly" This reverts commit 490499f9a35b36b72c0b7b30322b9838774b93fe. --- Bugzilla/Bug.pm | 52 +++++---- Bugzilla/Error/Template.pm | 26 ----- process_bug.cgi | 104 +++++++----------- .../en/default/bug/process/bugmail.html.tmpl | 4 +- 4 files changed, 71 insertions(+), 115 deletions(-) delete mode 100644 Bugzilla/Error/Template.pm diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 637d941145..69734e6c04 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1331,13 +1331,13 @@ sub remove_from_db { ##################################################################### sub send_changes { - my ($self, $changes) = @_; - my @results; + my ($self, $changes, $vars) = @_; + my $user = Bugzilla->user; - my $old_qa = $changes->{'qa_contact'} + my $old_qa = $changes->{'qa_contact'} ? $changes->{'qa_contact'}->[0] : ''; - my $old_own = $changes->{'assigned_to'} + my $old_own = $changes->{'assigned_to'} ? $changes->{'assigned_to'}->[0] : ''; my $old_cc = $changes->{cc} ? $changes->{cc}->[0] : ''; @@ -1349,15 +1349,15 @@ sub send_changes { changer => $user, ); - push @results, _send_bugmail( - { id => $self->id, type => 'bug', forced => \%forced }); + my $recipient_count = _send_bugmail( + { id => $self->id, type => 'bug', forced => \%forced }, $vars); # If the bug was marked as a duplicate, we need to notify users on the # other bug of any changes to that bug. my $new_dup_id = $changes->{'dup_id'} ? $changes->{'dup_id'}->[1] : undef; if ($new_dup_id) { - push @results, _send_bugmail( - { forced => { changer => $user }, type => "dupe", id => $new_dup_id }); + $recipient_count += _send_bugmail( + { forced => { changer => $user }, type => "dupe", id => $new_dup_id }, $vars); } # If there were changes in dependencies, we need to notify those @@ -1376,7 +1376,7 @@ sub send_changes { foreach my $id (@{ $self->blocked }) { $params->{id} = $id; - push @results, _send_bugmail($params); + $recipient_count += _send_bugmail($params, $vars); } } } @@ -1394,28 +1394,37 @@ sub send_changes { delete $changed_deps{''}; foreach my $id (sort { $a <=> $b } (keys %changed_deps)) { - push @results, _send_bugmail( - { forced => { changer => $user }, type => "dep", id => $id }); + $recipient_count += _send_bugmail( + { forced => { changer => $user }, type => "dep", id => $id }, $vars); } # Sending emails for the referenced bugs. foreach my $ref_bug_id (uniq @{ $self->{see_also_changes} || [] }) { - push @results, _send_bugmail( - { forced => { changer => $user }, id => $ref_bug_id }); + $recipient_count += _send_bugmail( + { forced => { changer => $user }, id => $ref_bug_id }, $vars); } - return \@results; + return $recipient_count; } sub _send_bugmail { - my ($params) = @_; + my ($params, $vars) = @_; require Bugzilla::BugMail; - my $sent_bugmail = + my $results = Bugzilla::BugMail::Send($params->{'id'}, $params->{'forced'}, $params); - return { params => $params, sent_bugmail => $sent_bugmail }; + if (Bugzilla->usage_mode == USAGE_MODE_BROWSER) { + my $template = Bugzilla->template; + $vars->{$_} = $params->{$_} foreach keys %$params; + $vars->{'sent_bugmail'} = $results; + $template->process("bug/process/results.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + $vars->{'header_done'} = 1; + } + + return scalar @{ $results->{sent} }; } ##################################################################### @@ -2769,11 +2778,10 @@ sub _set_product { if (%vars) { $vars{product} = $product; $vars{bug} = $self; - require Bugzilla::Error::Template; - die Bugzilla::Error::Template->new( - file => "bug/process/verify-new-product.html.tmpl", - vars => \%vars - ); + my $template = Bugzilla->template; + $template->process("bug/process/verify-new-product.html.tmpl", + \%vars) || ThrowTemplateError($template->error()); + exit; } } else { diff --git a/Bugzilla/Error/Template.pm b/Bugzilla/Error/Template.pm deleted file mode 100644 index a3afa7e4d9..0000000000 --- a/Bugzilla/Error/Template.pm +++ /dev/null @@ -1,26 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This Source Code Form is "Incompatible With Secondary Licenses", as -# defined by the Mozilla Public License, v. 2.0. - -package Bugzilla::Error::Template; - -use 5.10.1; -use strict; -use warnings; -use Moo; - -has 'file' => ( - is => 'ro', - required => 1, -); - -has 'vars' => ( - is => 'ro', - default => sub { {} }, -); - - -1; \ No newline at end of file diff --git a/process_bug.cgi b/process_bug.cgi index f97d02b282..80018cfb30 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -27,7 +27,6 @@ use Bugzilla::Status; use Bugzilla::Token; use Bugzilla::Hook; -use Scalar::Util qw(blessed); use List::MoreUtils qw(firstidx); use Storable qw(dclone); @@ -112,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') || ''; @@ -157,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; @@ -186,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); @@ -364,21 +361,7 @@ foreach my $b (@bug_objects) { push(@remove_groups, $g->name) if grep { $_ eq $g->name } @unchecked_groups; } local $set_all_fields{groups}->{remove} = \@remove_groups; - my $ok = eval { - $b->set_all(\%set_all_fields); - 1; - }; - unless ($ok) { - my $error = $@; - if (blessed $error && $error->isa('Bugzilla::Error::Template')) { - print $cgi->header(); - $template->process($error->file, $error->vars); - exit; - } - else { - die $error; - } - } + $b->set_all(\%set_all_fields); } if (defined $cgi->param('id')) { @@ -393,7 +376,6 @@ if (defined $cgi->param('id')) { ############################## # Do Actual Database Updates # ############################## -my $sent_changes; foreach my $bug (@bug_objects) { my $changes = $bug->update(); @@ -407,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) diff --git a/template/en/default/bug/process/bugmail.html.tmpl b/template/en/default/bug/process/bugmail.html.tmpl index 0c4f2f27d9..21e4ff7b74 100644 --- a/template/en/default/bug/process/bugmail.html.tmpl +++ b/template/en/default/bug/process/bugmail.html.tmpl @@ -24,13 +24,13 @@ # sent_bugmail: The results of Bugzilla::BugMail::Send(). #%] -[% USE Bugzilla %] +[% USE CGI %] [% 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') + || CGI.cookie('show_bugmail_recipients') || !user.can_see_bug(mailing_bugid) %] [% recipient_count = sent_bugmail.sent.size %] From 574643ad6a9d62063f2d47f82328c1a4b7f5979d Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 20 Dec 2016 09:31:05 -0500 Subject: [PATCH 7/7] Bug 1313766 - Bugzilla::Bug->send_changes() should not output HTML directly --- Bugzilla/Bug.pm | 52 ++++----- Bugzilla/Error/Template.pm | 26 +++++ process_bug.cgi | 104 +++++++++++------- .../en/default/bug/process/bugmail.html.tmpl | 4 +- 4 files changed, 116 insertions(+), 70 deletions(-) create mode 100644 Bugzilla/Error/Template.pm diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 69734e6c04..637d941145 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1331,13 +1331,13 @@ sub remove_from_db { ##################################################################### sub send_changes { - my ($self, $changes, $vars) = @_; - + my ($self, $changes) = @_; + my @results; my $user = Bugzilla->user; - my $old_qa = $changes->{'qa_contact'} + my $old_qa = $changes->{'qa_contact'} ? $changes->{'qa_contact'}->[0] : ''; - my $old_own = $changes->{'assigned_to'} + my $old_own = $changes->{'assigned_to'} ? $changes->{'assigned_to'}->[0] : ''; my $old_cc = $changes->{cc} ? $changes->{cc}->[0] : ''; @@ -1349,15 +1349,15 @@ sub send_changes { changer => $user, ); - my $recipient_count = _send_bugmail( - { id => $self->id, type => 'bug', forced => \%forced }, $vars); + push @results, _send_bugmail( + { id => $self->id, type => 'bug', forced => \%forced }); # If the bug was marked as a duplicate, we need to notify users on the # other bug of any changes to that bug. my $new_dup_id = $changes->{'dup_id'} ? $changes->{'dup_id'}->[1] : undef; if ($new_dup_id) { - $recipient_count += _send_bugmail( - { forced => { changer => $user }, type => "dupe", id => $new_dup_id }, $vars); + push @results, _send_bugmail( + { forced => { changer => $user }, type => "dupe", id => $new_dup_id }); } # If there were changes in dependencies, we need to notify those @@ -1376,7 +1376,7 @@ sub send_changes { foreach my $id (@{ $self->blocked }) { $params->{id} = $id; - $recipient_count += _send_bugmail($params, $vars); + push @results, _send_bugmail($params); } } } @@ -1394,37 +1394,28 @@ sub send_changes { delete $changed_deps{''}; foreach my $id (sort { $a <=> $b } (keys %changed_deps)) { - $recipient_count += _send_bugmail( - { forced => { changer => $user }, type => "dep", id => $id }, $vars); + push @results, _send_bugmail( + { forced => { changer => $user }, type => "dep", id => $id }); } # Sending emails for the referenced bugs. foreach my $ref_bug_id (uniq @{ $self->{see_also_changes} || [] }) { - $recipient_count += _send_bugmail( - { forced => { changer => $user }, id => $ref_bug_id }, $vars); + push @results, _send_bugmail( + { forced => { changer => $user }, id => $ref_bug_id }); } - return $recipient_count; + return \@results; } sub _send_bugmail { - my ($params, $vars) = @_; + my ($params) = @_; require Bugzilla::BugMail; - my $results = + my $sent_bugmail = Bugzilla::BugMail::Send($params->{'id'}, $params->{'forced'}, $params); - if (Bugzilla->usage_mode == USAGE_MODE_BROWSER) { - my $template = Bugzilla->template; - $vars->{$_} = $params->{$_} foreach keys %$params; - $vars->{'sent_bugmail'} = $results; - $template->process("bug/process/results.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - $vars->{'header_done'} = 1; - } - - return scalar @{ $results->{sent} }; + return { params => $params, sent_bugmail => $sent_bugmail }; } ##################################################################### @@ -2778,10 +2769,11 @@ sub _set_product { if (%vars) { $vars{product} = $product; $vars{bug} = $self; - my $template = Bugzilla->template; - $template->process("bug/process/verify-new-product.html.tmpl", - \%vars) || ThrowTemplateError($template->error()); - exit; + require Bugzilla::Error::Template; + die Bugzilla::Error::Template->new( + file => "bug/process/verify-new-product.html.tmpl", + vars => \%vars + ); } } else { diff --git a/Bugzilla/Error/Template.pm b/Bugzilla/Error/Template.pm new file mode 100644 index 0000000000..a3afa7e4d9 --- /dev/null +++ b/Bugzilla/Error/Template.pm @@ -0,0 +1,26 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::Error::Template; + +use 5.10.1; +use strict; +use warnings; +use Moo; + +has 'file' => ( + is => 'ro', + required => 1, +); + +has 'vars' => ( + is => 'ro', + default => sub { {} }, +); + + +1; \ No newline at end of file diff --git a/process_bug.cgi b/process_bug.cgi index 80018cfb30..0858a3ff87 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -27,6 +27,7 @@ use Bugzilla::Status; use Bugzilla::Token; use Bugzilla::Hook; +use Scalar::Util qw(blessed); use List::MoreUtils qw(firstidx); use Storable qw(dclone); @@ -111,8 +112,6 @@ 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') || ''; @@ -158,6 +157,7 @@ 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; @@ -186,6 +186,9 @@ $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); @@ -361,7 +364,21 @@ foreach my $b (@bug_objects) { push(@remove_groups, $g->name) if grep { $_ eq $g->name } @unchecked_groups; } local $set_all_fields{groups}->{remove} = \@remove_groups; - $b->set_all(\%set_all_fields); + my $ok = eval { + $b->set_all(\%set_all_fields); + 1; + }; + unless ($ok) { + my $error = $@; + if (blessed $error && $error->isa('Bugzilla::Error::Template')) { + print $cgi->header(); + $template->process($error->file, $error->vars); + exit; + } + else { + die $error; + } + } } if (defined $cgi->param('id')) { @@ -376,6 +393,7 @@ if (defined $cgi->param('id')) { ############################## # Do Actual Database Updates # ############################## +my @all_sent_changes; foreach my $bug (@bug_objects) { my $changes = $bug->update(); @@ -389,50 +407,60 @@ foreach my $bug (@bug_objects) { } } - my $recipient_count = $bug->send_changes($changes, $vars); + push @all_sent_changes, $bug->send_changes($changes); } # Delete the session token used for the mass-change. delete_token($token) unless $cgi->param('id'); -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}); + +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; + } + $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; + $template->process($format->{template}, $vars) + || ThrowTemplateError($template->error()); + exit; + } } -} elsif ($action ne 'nothing') { - ThrowCodeError("invalid_post_bug_submit_action"); -} -# End the response page. -unless (Bugzilla->usage_mode == USAGE_MODE_EMAIL) { + # End the response page. $template->process("bug/navigate.html.tmpl", $vars) || ThrowTemplateError($template->error()); $template->process("global/footer.html.tmpl", $vars) diff --git a/template/en/default/bug/process/bugmail.html.tmpl b/template/en/default/bug/process/bugmail.html.tmpl index 21e4ff7b74..0c4f2f27d9 100644 --- a/template/en/default/bug/process/bugmail.html.tmpl +++ b/template/en/default/bug/process/bugmail.html.tmpl @@ -24,13 +24,13 @@ # sent_bugmail: The results of Bugzilla::BugMail::Send(). #%] -[% USE CGI %] +[% 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' - || CGI.cookie('show_bugmail_recipients') + || Bugzilla.cgi.cookie('show_bugmail_recipients') || !user.can_see_bug(mailing_bugid) %] [% recipient_count = sent_bugmail.sent.size %]