From be261168e64e418c382204ae613c9ccca6b3d526 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Fri, 16 Mar 2018 03:48:04 +0200 Subject: [PATCH 01/19] Bug 1446236 - use urlbase in AntiSpam extension --- extensions/AntiSpam/lib/Config.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/AntiSpam/lib/Config.pm b/extensions/AntiSpam/lib/Config.pm index ba7df84c2b..3cddb77ed6 100644 --- a/extensions/AntiSpam/lib/Config.pm +++ b/extensions/AntiSpam/lib/Config.pm @@ -53,7 +53,9 @@ sub get_param_list { default => "This account has been automatically disabled as a result of " . "a high number of comments tagged as abusive.
\n
\n" . "All interactions on Bugzilla should follow our " - . "" + . "localconfig->{'urlbase'} + . "page.cgi?id=etiquette.html\">" . "etiquette guidelines.
\n
\n" . "Please contact the address at the end of this message if you " . "believe this to be an error, or if you would like your account " From 7d5e31e932db6b684c14e9b854639a01a8a110e9 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Fri, 16 Mar 2018 03:48:41 +0200 Subject: [PATCH 02/19] Bug 1446236 - docs/en/rst/integrating/templates.rst: Fix a typo --- docs/en/rst/integrating/templates.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/rst/integrating/templates.rst b/docs/en/rst/integrating/templates.rst index a6788cb89a..e17e839012 100644 --- a/docs/en/rst/integrating/templates.rst +++ b/docs/en/rst/integrating/templates.rst @@ -262,7 +262,7 @@ customizing for your installation. It needs a couple of lines of boilerplate at the top like this:: [% USE Bugzilla %] - [% cgi = Bugzilla.cgi % + [% cgi = Bugzilla.cgi %] Then, this template can reference the form fields you have created using the syntax ``[% cgi.param("field_name") %]``. When a bug report is From fd2cc9236bbaaa95e65b78cab784e163893837d4 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Fri, 16 Mar 2018 03:50:21 +0200 Subject: [PATCH 03/19] Bug 1446236 - Allow customizing link to bug writing guidelines --- .../en/default/bug/create/create-web-bounty.html.tmpl | 2 +- .../BMO/template/en/default/bug/create/user-message.html.tmpl | 2 +- .../BMO/template/en/default/pages/bug-writing.html.tmpl | 2 +- extensions/BMO/template/en/default/pages/etiquette.html.tmpl | 2 +- .../template/en/default/guided/guided.html.tmpl | 2 +- template/en/default/bug/create/user-message.html.tmpl | 2 +- template/en/default/global/variables.none.tmpl | 4 +++- template/en/default/index.html.tmpl | 2 +- 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/extensions/BMO/template/en/default/bug/create/create-web-bounty.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-web-bounty.html.tmpl index 09265fe0ef..49602c84db 100644 --- a/extensions/BMO/template/en/default/bug/create/create-web-bounty.html.tmpl +++ b/extensions/BMO/template/en/default/bug/create/create-web-bounty.html.tmpl @@ -81,7 +81,7 @@ function validateAndSubmit() { diff --git a/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl b/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl index f888142624..5fae41e572 100644 --- a/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl +++ b/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl @@ -17,7 +17,7 @@ [% END +%] [% UNLESS no_bug_guidelines %] Before reporting a [% terms.bug %], make sure you've read our - + [% terms.bug %] writing guidelines and double checked that your [% terms.bug %] hasn't already been reported. Consult our list of most frequently reported [% terms.bugs %] and diff --git a/extensions/BMO/template/en/default/pages/bug-writing.html.tmpl b/extensions/BMO/template/en/default/pages/bug-writing.html.tmpl index e1c67605f1..a6b9a5f449 100644 --- a/extensions/BMO/template/en/default/pages/bug-writing.html.tmpl +++ b/extensions/BMO/template/en/default/pages/bug-writing.html.tmpl @@ -7,5 +7,5 @@ #%] [% PROCESS global/redirect.html.tmpl - url = "https://developer.mozilla.org/docs/Mozilla/QA/Bug_writing_guidelines" + url = "[% terms.BugWritingGuidelinesURL %]" %] diff --git a/extensions/BMO/template/en/default/pages/etiquette.html.tmpl b/extensions/BMO/template/en/default/pages/etiquette.html.tmpl index a8ce04be67..662bdaad94 100644 --- a/extensions/BMO/template/en/default/pages/etiquette.html.tmpl +++ b/extensions/BMO/template/en/default/pages/etiquette.html.tmpl @@ -163,7 +163,7 @@

See Also

- The [% terms.Bug %] Writing Guidelines. + The [% terms.Bug %] Writing Guidelines.

[% INCLUDE global/footer.html.tmpl %] diff --git a/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl b/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl index d202a3c780..0e802bdbc4 100644 --- a/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl +++ b/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl @@ -339,7 +339,7 @@ Product: ?:
  • Please fill out this form clearly, precisely and in as much detail as you can manage.
  • Please report only a single problem at a time.
  • -
  • These guidelines +
  • These guidelines explain how to write effective [% terms.bug %] reports.
diff --git a/template/en/default/bug/create/user-message.html.tmpl b/template/en/default/bug/create/user-message.html.tmpl index fc2447c714..0a7a93130d 100644 --- a/template/en/default/bug/create/user-message.html.tmpl +++ b/template/en/default/bug/create/user-message.html.tmpl @@ -30,7 +30,7 @@ [% PROCESS global/variables.none.tmpl %] Before reporting [% terms.abug %], please read the - + [% terms.bug %] writing guidelines, please look at the list of most frequently reported [% terms.bugs %], and please search for the [% terms.bug %]. diff --git a/template/en/default/global/variables.none.tmpl b/template/en/default/global/variables.none.tmpl index 5ebf695c07..c57dac890b 100644 --- a/template/en/default/global/variables.none.tmpl +++ b/template/en/default/global/variables.none.tmpl @@ -37,7 +37,9 @@ "bugs" => "bugs", "Bugs" => "Bugs", "zeroSearchResults" => "Zarro Boogs found", - "Bugzilla" => "Bugzilla" + "Bugzilla" => "Bugzilla", + + "BugWritingGuidelinesURL" => "https://developer.mozilla.org/docs/Mozilla/QA/Bug_writing_guidelines", } %] diff --git a/template/en/default/index.html.tmpl b/template/en/default/index.html.tmpl index 8696d71370..ad6d02d3ed 100644 --- a/template/en/default/index.html.tmpl +++ b/template/en/default/index.html.tmpl @@ -105,7 +105,7 @@ [%- terms.Bugzilla %] Etiquette
  • - | [%- terms.Bug %] Writing Guidelines + | [%- terms.Bug %] Writing Guidelines
  • [% Hook.process('additional_links') %] From 30c5eab54923297dff131a3a0c39f3acb31dcf12 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Fri, 16 Mar 2018 03:51:51 +0200 Subject: [PATCH 04/19] Bug 1446236 - Use terms.Bugzilla when refering to the bugzilla install in the "disable my account" description --- template/en/default/account/prefs/account.html.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/en/default/account/prefs/account.html.tmpl b/template/en/default/account/prefs/account.html.tmpl index 43536d6c70..d5c0da6cb5 100644 --- a/template/en/default/account/prefs/account.html.tmpl +++ b/template/en/default/account/prefs/account.html.tmpl @@ -146,7 +146,7 @@

    - Your contributions on bugzilla.mozilla.org will still be visible; + Your contributions on [% terms.Bugzilla %] will still be visible; however, your email address and name will be removed in most locations. We are not able to remove your details that are part of comment text.

    From 10f2057fb3ddaf34fbe08e7ba548a4312a77f38d Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Fri, 16 Mar 2018 03:52:42 +0200 Subject: [PATCH 05/19] Bug 1446236 - fix typo in comment --- Bugzilla/Install/Filesystem.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index baa06ad3a9..96114a072e 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -417,7 +417,7 @@ sub update_filesystem { # Delete old files that no longer need to exist # 2001-04-29 jake@bugzilla.org - Remove oldemailtech - # http://bugzilla.mozilla.org/show_bugs.cgi?id=71552 + # http://bugzilla.mozilla.org/show_bug.cgi?id=71552 if (-d 'shadow') { print "Removing shadow directory...\n"; rmtree("shadow"); From 92e6a73df985fe736fc989721a3b5360b3ad27ce Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Thu, 15 Mar 2018 22:30:48 -0400 Subject: [PATCH 06/19] add Bugzilla->urlbase method that returns a URI object --- Bugzilla.pm | 7 +++++++ Bugzilla/CGI.pm | 2 +- Bugzilla/Template.pm | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Bugzilla.pm b/Bugzilla.pm index 99388f609c..01c5d03dee 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -46,6 +46,7 @@ use File::Spec::Functions; use Safe; use JSON::XS qw(decode_json); use Scope::Guard; +use URI; use parent qw(Bugzilla::CPAN); @@ -162,6 +163,12 @@ sub localconfig { ||= Bugzilla::Localconfig->new(read_localconfig()); } +sub urlbase { + my ($class) = @_; + + # Since this could be modified, we have to return a new one every time. + return URI->new($class->localconfig->{urlbase}); +} sub params { return request_cache->{params} ||= Bugzilla::Config::read_param_file(); diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index e4245a8622..2facf495d0 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -540,7 +540,7 @@ sub send_cookie { } # Add the default path and the domain in. - state $uri = URI->new(Bugzilla->localconfig->urlbase); + state $uri = Bugzilla->urlbase; $paramhash{'-path'} = $uri->path; # we don't set the domain. diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 59de9eac40..e970b789ac 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -985,7 +985,7 @@ sub create { 'sudoer' => sub { return Bugzilla->sudoer; }, # Allow templates to access the "correct" URLBase value - 'urlbase' => sub { return Bugzilla->localconfig->urlbase; }, + 'urlbase' => sub { Bugzilla->urlbase }, # Allow templates to get the absolute path of the URLBase value 'basepath' => sub { return Bugzilla->localconfig->basepath; }, From 529fe30905ffbca6d65bf880d962bb0329a12eed Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Fri, 16 Mar 2018 15:45:47 +0200 Subject: [PATCH 07/19] Bug 1446236 - fix several occurrences of a typo (user's of) --- extensions/BMO/lib/WebService.pm | 2 +- extensions/EditComments/lib/WebService.pm | 2 +- extensions/Ember/lib/WebService.pm | 2 +- extensions/MyDashboard/lib/WebService.pm | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/BMO/lib/WebService.pm b/extensions/BMO/lib/WebService.pm index 00808c7d13..ace7b6e924 100644 --- a/extensions/BMO/lib/WebService.pm +++ b/extensions/BMO/lib/WebService.pm @@ -116,7 +116,7 @@ Bugzilla::Extension::BMO::Webservice - The BMO WebServices API =head1 DESCRIPTION -This module contains API methods that are useful to user's of bugzilla.mozilla.org. +This module contains API methods that are useful to users of bugzilla.mozilla.org. =head1 METHODS diff --git a/extensions/EditComments/lib/WebService.pm b/extensions/EditComments/lib/WebService.pm index fe677e1e5d..1fa9cb636a 100644 --- a/extensions/EditComments/lib/WebService.pm +++ b/extensions/EditComments/lib/WebService.pm @@ -240,7 +240,7 @@ Bugzilla::Extension::EditComments::Webservice - The EditComments WebServices API =head1 DESCRIPTION -This module contains API methods that are useful to user's of bugzilla.mozilla.org. +This module contains API methods that are useful to users of bugzilla.mozilla.org. =head1 METHODS diff --git a/extensions/Ember/lib/WebService.pm b/extensions/Ember/lib/WebService.pm index 1c1b35aea7..4d2ccccde0 100644 --- a/extensions/Ember/lib/WebService.pm +++ b/extensions/Ember/lib/WebService.pm @@ -800,7 +800,7 @@ Bugzilla::Extension::Ember::Webservice - The BMO Ember WebServices API =head1 DESCRIPTION -This module contains API methods that are useful to user's of the Bugzilla Ember +This module contains API methods that are useful to users of the Bugzilla Ember based UI. =head1 METHODS diff --git a/extensions/MyDashboard/lib/WebService.pm b/extensions/MyDashboard/lib/WebService.pm index 4023791a34..a88c0db35d 100644 --- a/extensions/MyDashboard/lib/WebService.pm +++ b/extensions/MyDashboard/lib/WebService.pm @@ -176,7 +176,7 @@ Bugzilla::Extension::MyDashboard::Webservice - The MyDashboard WebServices API =head1 DESCRIPTION -This module contains API methods that are useful to user's of bugzilla.mozilla.org. +This module contains API methods that are useful to users of bugzilla.mozilla.org. =head1 METHODS From 59aba64037fb8be2c15d4eda2aaa32b60c0fbc62 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 18 Mar 2018 06:20:04 +0200 Subject: [PATCH 08/19] Bug 1446236 - Bugzilla/Search.pm: Use Bugzilla::Extension::TrackingFlags only when present --- Bugzilla/Search.pm | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 7afcaf77bf..9c7b6d82eb 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -34,6 +34,7 @@ use Date::Format; use Date::Parse; use Scalar::Util qw(blessed); use List::MoreUtils qw(all firstidx part uniq); +use List::Util qw(any); use POSIX qw(INT_MAX); use Storable qw(dclone); use Time::HiRes qw(gettimeofday tv_interval); @@ -802,19 +803,23 @@ sub data { # BMO - to avoid massive amounts of joins, if we're selecting a lot of # tracking flags, replace them with placeholders. the values will be # retrieved later and injected into the result. - my %tf_map = map { $_ => 1 } Bugzilla->tracking_flag_names; - my @tf_selected = grep { exists $tf_map{$_} } @orig_fields; - - # MySQL has a limit of 61 joins, and we want to avoid massive amounts of joins - # 30 ensures we won't hit the limit, nor generate too many joins - if (scalar @tf_selected > 30) { - foreach my $column (@tf_selected) { - $self->COLUMNS->{$column}->{name} = "'---'"; + state $have_tracking_flags + = any { $_->NAME eq 'TrackingFlags' } @{Bugzilla->extensions}; + if ($have_tracking_flags) { + my %tf_map = map { $_ => 1 } Bugzilla->tracking_flag_names; + my @tf_selected = grep { exists $tf_map{$_} } @orig_fields; + + # MySQL has a limit of 61 joins, and we want to avoid massive amounts of joins + # 30 ensures we won't hit the limit, nor generate too many joins + if (scalar @tf_selected > 30) { + foreach my $column (@tf_selected) { + $self->COLUMNS->{$column}->{name} = "'---'"; + } + $self->{tracking_flags} = \@tf_selected; + } + else { + $self->{tracking_flags} = []; } - $self->{tracking_flags} = \@tf_selected; - } - else { - $self->{tracking_flags} = []; } my $start_time = [gettimeofday()]; @@ -869,7 +874,7 @@ sub data { $self->{data} = [map { $data{$_} } @$bug_ids]; # BMO - get tracking flags values, and insert into result - if (@{$self->{tracking_flags}}) { + if ($have_tracking_flags && @{$self->{tracking_flags}}) { # read values my $values; From 3e0ef11add66c9ca55b4e613839bb8d41f9b71c2 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 18 Mar 2018 06:56:59 +0200 Subject: [PATCH 09/19] Bug 1446236 - BugModal: Use TrackingFlags only when present --- extensions/BugModal/Extension.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm index a484c559b9..7bd67649f4 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -197,9 +197,13 @@ sub template_before_process { return if exists $bug->{error}; # trigger loading of tracking flags - Bugzilla::Extension::TrackingFlags->template_before_process({ - file => 'bug/edit.html.tmpl', vars => $vars, - }); + state $have_tracking_flags + = any { $_->NAME eq 'TrackingFlags' } @{Bugzilla->extensions}; + if ($have_tracking_flags) { + Bugzilla::Extension::TrackingFlags->template_before_process({ + file => 'bug/edit.html.tmpl', vars => $vars, + }); + } if (any { $bug->product eq $_ } READABLE_BUG_STATUS_PRODUCTS) { my @flags = map { {name => $_->name, status => $_->status} } @{$bug->flags}; From cb8a64eae259f1f4991ba59fa996f4763373e658 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 18 Mar 2018 06:59:38 +0200 Subject: [PATCH 10/19] Bug 1446236 - Generate static error pages --- Bugzilla/Install/Filesystem.pm | 85 ++++++++++++++++++++++++++++++++++ errors/401.html | 40 ---------------- errors/403.html | 37 --------------- errors/404.html | 37 --------------- errors/500.html | 37 --------------- 5 files changed, 85 insertions(+), 151 deletions(-) delete mode 100644 errors/401.html delete mode 100644 errors/403.html delete mode 100644 errors/404.html delete mode 100644 errors/500.html diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index 96114a072e..10e9a38a69 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -55,6 +55,51 @@ use constant HTTPD_ENV => qw( NYTPROF_DIR ); +sub _error_page { + my ($code, $title, $description) = @_; + my $host = Bugzilla->urlbase->host; + + return < + + + $title + + + + buggie +
    +

    $title

    +

    $description

    +

    Error $code

    +

    $host

    +
    + + +EOT +} + ############### # Permissions # ############### @@ -344,6 +389,46 @@ sub FILESYSTEM { {perms => CGI_READ, overwrite => 1, contents => $yui3_all_css}, ); + # Create static error pages. + $create_files{"errors/401.html"} = { + perms => CGI_READ, + overwrite => 1, + contents => _error_page( + 401, 'Authentication Required', + "This server could not verify that you are authorized to access + that URL. you either supplied the wrong credentials (e.g., bad + password), or your browser doesn't understand how to supply the + credentials required." + ) + }; + $create_files{"errors/403.html"} = { + perms => CGI_READ, + overwrite => 1, + contents => _error_page( + 403, + 'Access Denied', + "Access to the requested resource has been denied." + ) + }; + $create_files{"errors/404.html"} = { + perms => CGI_READ, + overwrite => 1, + contents => _error_page( + 404, + 'Object Not Found', + "The requested URL was not found on this server." + ) + }; + $create_files{"errors/500.html"} = { + perms => CGI_READ, + overwrite => 1, + contents => _error_page( + 500, + 'Internal Server Error', + "The server encountered an internal error and was unable to complete your request." + ) + }; + Bugzilla::Hook::process( 'install_filesystem', { diff --git a/errors/401.html b/errors/401.html deleted file mode 100644 index fbcc3ea2a4..0000000000 --- a/errors/401.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - Access Denied - - - - buggie -
    -

    Authentication Required

    -

    This server could not verify that you are authorized to access - that URL. you either supplied the wrong credentials (e.g., bad - password), or your browser doesn't understand how to supply the - credentials required.

    -

    Error 401

    -

    bugzilla.mozilla.org

    -
    - - diff --git a/errors/403.html b/errors/403.html deleted file mode 100644 index e2faf8522c..0000000000 --- a/errors/403.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - Access Denied - - - - buggie -
    -

    Access Denied

    -

    Access to the requested resource has been denied.

    -

    Error 403

    -

    bugzilla.mozilla.org

    -
    - - diff --git a/errors/404.html b/errors/404.html deleted file mode 100644 index 3b476471c1..0000000000 --- a/errors/404.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - Object Not Found - - - - buggie -
    -

    Object Not Found

    -

    The requested URL was not found on this server.

    -

    Error 404

    -

    bugzilla.mozilla.org

    -
    - - diff --git a/errors/500.html b/errors/500.html deleted file mode 100644 index e0657001d9..0000000000 --- a/errors/500.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - Internal Server Error - - - - buggie -
    -

    Internal Server Error

    -

    The server encountered an internal error and was unable to complete your request.

    -

    Error 500

    -

    bugzilla.mozilla.org

    -
    - - From 8e5e1b60ed0fbbab4d9208fd3efdb431006b7a90 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 18 Mar 2018 07:00:27 +0200 Subject: [PATCH 11/19] Bug 1446236 - template/en/default/bug/new_bug.html.tmpl: Use relative URLs --- .../BMO/template/en/default/bug/create/user-message.html.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl b/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl index 5fae41e572..7d9b3c8f6c 100644 --- a/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl +++ b/extensions/BMO/template/en/default/bug/create/user-message.html.tmpl @@ -19,8 +19,8 @@ Before reporting a [% terms.bug %], make sure you've read our [% terms.bug %] writing guidelines and double checked that your [% terms.bug %] hasn't already - been reported. Consult our list of - most frequently reported [% terms.bugs %] and + been reported. Consult our list of + most frequently reported [% terms.bugs %] and search through descriptions of previously reported [% terms.bugs %]. [% END %]

    From 46b975e52edfc5b91eedc7afaedb5bf9d4d5a42a Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 18 Mar 2018 07:00:50 +0200 Subject: [PATCH 12/19] Bug 1446236 - Allow customizing the name of the "nobody" user (nobody@mozilla.org) --- Bugzilla/Config/General.pm | 8 ++++++++ Bugzilla/Install/DB.pm | 2 +- extensions/BMO/Extension.pm | 10 ++++++---- extensions/BMO/bin/bug_1093952.pl | 2 +- extensions/BMO/bin/migrate-github-pull-requests.pl | 2 +- .../template/en/default/pages/group_admins.html.tmpl | 2 +- .../template/en/default/bug_modal/edit.html.tmpl | 2 +- extensions/ComponentWatching/Extension.pm | 3 +-- extensions/PhabBugz/lib/Util.pm | 2 +- .../Review/bin/migrate_mentor_from_whiteboard.pl | 2 +- extensions/Review/lib/WebService.pm | 3 ++- extensions/TrackingFlags/bin/bug_825946.pl | 2 +- extensions/TrackingFlags/bin/bulk_flag_clear.pl | 2 +- scripts/disable-stale-users.pl | 6 ++++-- scripts/eject-users-from-groups.pl | 2 +- scripts/generate_bmo_data.pl | 6 +++--- scripts/move_os.pl | 3 ++- scripts/movebugs.pl | 8 +++++--- scripts/nagios_blocker_checker.pl | 2 +- scripts/remove_idle_group_members.pl | 2 +- scripts/reset_default_user.pl | 2 +- t/bmo/comments.t | 4 ++-- template/en/default/attachment/create.html.tmpl | 2 +- 23 files changed, 47 insertions(+), 32 deletions(-) diff --git a/Bugzilla/Config/General.pm b/Bugzilla/Config/General.pm index 84cc1bb144..bf40882486 100644 --- a/Bugzilla/Config/General.pm +++ b/Bugzilla/Config/General.pm @@ -24,6 +24,14 @@ use constant get_param_list => ( checker => \&check_email }, + { + name => 'nobody_user', + type => 't', + no_reset => '1', + default => 'nobody@mozilla.org', + checker => \&check_email + }, + { name => 'docs_urlbase', type => 't', diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index 60ae614d0e..e761473b76 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -4227,7 +4227,7 @@ sub _migrate_group_owners { my $dbh = Bugzilla->dbh; return if $dbh->bz_column_info('groups', 'owner_user_id'); $dbh->bz_add_column('groups', 'owner_user_id', {TYPE => 'INT3'}); - my $nobody = Bugzilla::User->check('nobody@mozilla.org'); + my $nobody = Bugzilla::User->check(Bugzilla->params->{'nobody_user'}); $dbh->do('UPDATE groups SET owner_user_id = ?', undef, $nobody->id); } diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 91b0c7ff35..b2616510e5 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -971,7 +971,8 @@ sub object_end_of_create { # Add default searches to new user's footer my $dbh = Bugzilla->dbh; - my $sharer = Bugzilla::User->new({name => 'nobody@mozilla.org'}) or return; + my $sharer = Bugzilla::User->new({name => Bugzilla->params->{'nobody_user'}}) + or return; my $group = Bugzilla::Group->new({name => 'everyone'}) or return; foreach my $definition (@default_named_queries) { @@ -1011,7 +1012,7 @@ sub _bug_reporters_hw_os { sub _bug_is_unassigned { my ($self) = @_; my $assignee = $self->assigned_to->login; - return $assignee eq 'nobody@mozilla.org' || $assignee =~ /@(?!invalid).+\.bugs$/; + return $assignee eq Bugzilla->params->{'nobody_user'} || $assignee =~ /@(?!invalid).+\.bugs$/; } sub _bug_has_current_patch { @@ -1191,7 +1192,7 @@ sub object_start_of_update { # and the assignee isn't a real person return - unless $new_bug->assigned_to->login eq 'nobody@mozilla.org' + unless $new_bug->assigned_to->login eq Bugzilla->params->{'nobody_user'} || $new_bug->assigned_to->login =~ /@(?!invalid).+\.bugs$/; # and the user can set the status to NEW @@ -1926,7 +1927,8 @@ sub _post_employee_incident_bug { my ($investigate_bug, $ssh_key_bug); my $old_user = Bugzilla->user; eval { - Bugzilla->set_user(Bugzilla::User->new({name => 'nobody@mozilla.org'})); + Bugzilla->set_user(Bugzilla::User->new( + {name => Bugzilla->params->{'nobody_user'}})); my $new_user = Bugzilla->user; # HACK: User needs to be in the editbugs and primary bug's group to allow diff --git a/extensions/BMO/bin/bug_1093952.pl b/extensions/BMO/bin/bug_1093952.pl index 20a9d10daa..d5c1c07eda 100755 --- a/extensions/BMO/bin/bug_1093952.pl +++ b/extensions/BMO/bin/bug_1093952.pl @@ -55,7 +55,7 @@ print "Press to stop or to continue...\n"; getc(); -my $nobody = Bugzilla::User->check({name => 'nobody@mozilla.org'}); +my $nobody = Bugzilla::User->check({name => Bugzilla->params->{'nobody_user'}}); my $field = Bugzilla::Field->check({name => 'status_whiteboard'}); my $when = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)'); diff --git a/extensions/BMO/bin/migrate-github-pull-requests.pl b/extensions/BMO/bin/migrate-github-pull-requests.pl index b7bdd0d680..c2d6d313f3 100755 --- a/extensions/BMO/bin/migrate-github-pull-requests.pl +++ b/extensions/BMO/bin/migrate-github-pull-requests.pl @@ -23,7 +23,7 @@ use Bugzilla::Util qw(trim); my $dbh = Bugzilla->dbh; -my $nobody = Bugzilla::User->check({name => 'nobody@mozilla.org'}); +my $nobody = Bugzilla::User->check({name => Bugzilla->params->{'nobody_user'}}); my $field = Bugzilla::Field->check({name => 'attachments.mimetype'}); # grab list of suitable attachments diff --git a/extensions/BMO/template/en/default/pages/group_admins.html.tmpl b/extensions/BMO/template/en/default/pages/group_admins.html.tmpl index 7921da071a..f051891667 100644 --- a/extensions/BMO/template/en/default/pages/group_admins.html.tmpl +++ b/extensions/BMO/template/en/default/pages/group_admins.html.tmpl @@ -41,7 +41,7 @@ [% group.name FILTER html %] - [% IF group.owner.login == 'nobody@mozilla.org' %] + [% IF group.owner.login == Bugzilla.params.nobody_user %] – [% ELSE %] [% INCLUDE global/user.html.tmpl who = group.owner %] 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 aa90993027..4001074037 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -19,7 +19,7 @@ # these are used in a few places is_cced = bug.cc.contains(user.login); - unassigned = (bug.assigned_to.login == "nobody@mozilla.org") + unassigned = (bug.assigned_to.login == Bugzilla.params.nobody_user) || (bug.assigned_to.login.search('@(?!invalid).+\.bugs$')); # custom fields that have custom rendering, or should not be rendered diff --git a/extensions/ComponentWatching/Extension.pm b/extensions/ComponentWatching/Extension.pm index 1f4c64da5c..81f7855f69 100644 --- a/extensions/ComponentWatching/Extension.pm +++ b/extensions/ComponentWatching/Extension.pm @@ -23,7 +23,6 @@ use Bugzilla::Util qw(detaint_natural trim); our $VERSION = '2'; use constant REQUIRE_WATCH_USER => 1; -use constant DEFAULT_ASSIGNEE => 'nobody@mozilla.org'; use constant REL_COMPONENT_WATCHER => 15; @@ -100,7 +99,7 @@ sub template_before_create { sub template_before_process { my ($self, $args) = @_; return unless $args->{file} eq 'admin/components/create.html.tmpl'; - $args->{vars}{comp}{default_assignee}{login} = DEFAULT_ASSIGNEE; + $args->{vars}{comp}{default_assignee}{login} = Bugzilla->params->{'nobody_user'}; } # diff --git a/extensions/PhabBugz/lib/Util.pm b/extensions/PhabBugz/lib/Util.pm index 3c1bd26403..2f2a417af0 100644 --- a/extensions/PhabBugz/lib/Util.pm +++ b/extensions/PhabBugz/lib/Util.pm @@ -129,7 +129,7 @@ sub get_bug_role_phids { } sub is_bug_assigned { - return $_[0]->assigned_to->email ne 'nobody@mozilla.org'; + return $_[0]->assigned_to->email ne Bugzilla->params->{'nobody_user'}; } sub is_attachment_phab_revision { diff --git a/extensions/Review/bin/migrate_mentor_from_whiteboard.pl b/extensions/Review/bin/migrate_mentor_from_whiteboard.pl index e9a6230963..129879ae8e 100755 --- a/extensions/Review/bin/migrate_mentor_from_whiteboard.pl +++ b/extensions/Review/bin/migrate_mentor_from_whiteboard.pl @@ -36,7 +36,7 @@ <>; # we need to be logged in to do user searching and update bugs -my $nobody = Bugzilla::User->check({name => 'nobody@mozilla.org'}); +my $nobody = Bugzilla::User->check({name => Bugzilla->params->{'nobody_user'}}); $nobody->{groups} = [Bugzilla::Group->get_all]; Bugzilla->set_user($nobody); diff --git a/extensions/Review/lib/WebService.pm b/extensions/Review/lib/WebService.pm index 6f3183c9dd..dfbbcd30ea 100644 --- a/extensions/Review/lib/WebService.pm +++ b/extensions/Review/lib/WebService.pm @@ -53,7 +53,8 @@ sub suggestions { # we always need to be authenticated to perform user matching my $user = Bugzilla->user; if (!$user->id) { - Bugzilla->set_user(Bugzilla::User->check({name => 'nobody@mozilla.org'})); + Bugzilla->set_user(Bugzilla::User->check( + {name => Bugzilla->params->{'nobody_user'}})); push @reviewers, @{$bug->mentors}; Bugzilla->set_user($user); } diff --git a/extensions/TrackingFlags/bin/bug_825946.pl b/extensions/TrackingFlags/bin/bug_825946.pl index 055cec1938..df4b109ecc 100755 --- a/extensions/TrackingFlags/bin/bug_825946.pl +++ b/extensions/TrackingFlags/bin/bug_825946.pl @@ -24,7 +24,7 @@ BEGIN Bugzilla->usage_mode(USAGE_MODE_CMDLINE); my $dbh = Bugzilla->dbh; -my $user = Bugzilla::User->check({name => 'nobody@mozilla.org'}); +my $user = Bugzilla::User->check({name => Bugzilla->params->{'nobody_user'}}); my $tf_vis = $dbh->selectall_arrayref(<check({name => 'nobody@mozilla.org'}); +my $nobody = Bugzilla::User->check({name => Bugzilla->params->{'nobody_user'}}); # put our nobody user into all groups to avoid permissions issues $nobody->{groups} = [Bugzilla::Group->get_all]; diff --git a/scripts/disable-stale-users.pl b/scripts/disable-stale-users.pl index d289ef01ed..4d02fb9389 100755 --- a/scripts/disable-stale-users.pl +++ b/scripts/disable-stale-users.pl @@ -66,7 +66,7 @@ BEGIN components ON components.watch_user = profiles.userid WHERE - profiles.login_name != 'nobody@mozilla.org' + profiles.login_name != ? AND components.id IS NULL AND NOT profiles.login_name LIKE '%.bugs' AND NOT profiles.login_name LIKE '%.tld' @@ -77,14 +77,16 @@ BEGIN profiles.userid EOF +my $nobody = Bugzilla->params->{'nobody_user'}; if ($dump_sql) { + $sql =~ s/[?]/"$nobody"/; $sql =~ s/[?]/$date/g; print $sql; exit; } say STDERR "looking for users inactive since $date"; -my $users = $dbh->selectall_arrayref($sql, {Slice => {}}, $date, $date); +my $users = $dbh->selectall_arrayref($sql, {Slice => {}}, $nobody, $date, $date); my $total = scalar @$users; die "no matching users found.\n" unless $total; diff --git a/scripts/eject-users-from-groups.pl b/scripts/eject-users-from-groups.pl index be41b87626..219e65fb92 100755 --- a/scripts/eject-users-from-groups.pl +++ b/scripts/eject-users-from-groups.pl @@ -22,7 +22,7 @@ my $dbh = Bugzilla->dbh; my @remove_group_names; -my $nobody_name = 'nobody@mozilla.org'; +my $nobody_name = Bugzilla->params->{'nobody_user'}; my $admin_name = 'automation@bmo.tld'; GetOptions( diff --git a/scripts/generate_bmo_data.pl b/scripts/generate_bmo_data.pl index 30ae5a49e5..709874c1f0 100755 --- a/scripts/generate_bmo_data.pl +++ b/scripts/generate_bmo_data.pl @@ -147,7 +147,7 @@ my @users = ( { - login => 'nobody@mozilla.org', + login => Bugzilla->params->{'nobody_user'}, realname => 'Nobody; OK to take it and work on it', password => '*' }, @@ -232,7 +232,7 @@ name => 'General', description => 'For bugs in Firefox which do not fit into ' . 'other more specific Firefox components', - initialowner => 'nobody@mozilla.org', + initialowner => Bugzilla->params->{'nobody_user'}, initialqaowner => '', initial_cc => [], watch_user => 'general@firefox.bugs' @@ -251,7 +251,7 @@ description => 'This is the component for issues specific to bugzilla.mozilla.org ' . 'that do not belong in other components.', - initialowner => 'nobody@mozilla.org', + initialowner => Bugzilla->params->{'nobody_user'}, initialqaowner => '', initial_cc => [], watch_user => 'general@bugzilla.bugs' diff --git a/scripts/move_os.pl b/scripts/move_os.pl index 0117551cf8..ed7f257b37 100755 --- a/scripts/move_os.pl +++ b/scripts/move_os.pl @@ -42,7 +42,8 @@ = $dbh->selectcol_arrayref(q{SELECT bug_id FROM bugs WHERE bugs.op_sys = ?}, undef, $from_os); my $field = Bugzilla::Field->check({name => 'op_sys', cache => 1}); -my $nobody = Bugzilla::User->check({name => 'nobody@mozilla.org', cache => 1}); +my $nobody = Bugzilla::User->check( + {name => Bugzilla->params->{'nobody_user'}, cache => 1}); my $bug_count = @$bug_ids; if ($bug_count == 0) { diff --git a/scripts/movebugs.pl b/scripts/movebugs.pl index 376e9a8fff..920a856561 100755 --- a/scripts/movebugs.pl +++ b/scripts/movebugs.pl @@ -69,9 +69,11 @@ = $dbh->selectrow_array("SELECT id FROM fielddefs WHERE name = 'component'"); $component_field_id or die "Can't find field ID for 'component' field\n"; -my $user_id = $dbh->selectrow_array( - "SELECT userid FROM profiles WHERE login_name='nobody\@mozilla.org'"); -$user_id or die "Can't find user ID for 'nobody\@mozilla.org'\n"; +my $nobody = Bugzilla->params->{'nobody_user'}; +my $user_id + = $dbh->selectrow_array("SELECT userid FROM profiles WHERE login_name=?", + undef, $nobody); +$user_id or die "Can't find user ID for '$nobody'\n"; $dbh->bz_start_transaction(); diff --git a/scripts/nagios_blocker_checker.pl b/scripts/nagios_blocker_checker.pl index 795acc7ccc..6989059eed 100755 --- a/scripts/nagios_blocker_checker.pl +++ b/scripts/nagios_blocker_checker.pl @@ -29,7 +29,7 @@ assignee => '', product => '', component => '', - unassigned => 'nobody@mozilla.org', + unassigned => Bugzilla->params->{'nobody_user'}, # severities severity => 'major,critical,blocker', diff --git a/scripts/remove_idle_group_members.pl b/scripts/remove_idle_group_members.pl index 1840d9b9f9..8370cd790e 100755 --- a/scripts/remove_idle_group_members.pl +++ b/scripts/remove_idle_group_members.pl @@ -77,7 +77,7 @@ $dbh->bz_commit_transaction(); # nobody@mozilla.org cannot receive email - next if $group->owner->login eq 'nobody@mozilla.org'; + next if $group->owner->login eq Bugzilla->params->{'nobody_user'}; _send_email($group, \@users_removed); } diff --git a/scripts/reset_default_user.pl b/scripts/reset_default_user.pl index 99d9a31c9c..365282c299 100755 --- a/scripts/reset_default_user.pl +++ b/scripts/reset_default_user.pl @@ -54,7 +54,7 @@ sub usage { } # We will need these for entering into bugs_activity -my $who = Bugzilla::User->new({name => 'nobody@mozilla.org'}); +my $who = Bugzilla::User->new({name => Bugzilla->params->{'nobody_user'}}); my $field = Bugzilla::Field->new({name => $field_name}); my $product_id = $dbh->selectrow_array("SELECT id FROM products WHERE name = ?", diff --git a/t/bmo/comments.t b/t/bmo/comments.t index 08badc3f8a..cdac8f34e1 100644 --- a/t/bmo/comments.t +++ b/t/bmo/comments.t @@ -36,7 +36,7 @@ my $bug_1 = Bugzilla::Bug->create({ keywords => [], cc => [], comment => 'This is a brand new bug', - assigned_to => 'nobody@mozilla.org', + assigned_to => Bugzilla->params->{'nobody_user'}, }); ok($bug_1->id, "got a new bug"); @@ -56,7 +56,7 @@ my $bug_2 = Bugzilla::Bug->create({ keywords => [], cc => [], comment => "This is related to ${urlbase}show_bug.cgi?id=$bug_1_id", - assigned_to => 'nobody@mozilla.org', + assigned_to => Bugzilla->params->{'nobody_user'}, }); my $bug_2_id = $bug_2->id; diff --git a/template/en/default/attachment/create.html.tmpl b/template/en/default/attachment/create.html.tmpl index 1fc876d60e..5ffeafe936 100644 --- a/template/en/default/attachment/create.html.tmpl +++ b/template/en/default/attachment/create.html.tmpl @@ -74,7 +74,7 @@ If you want to assign this [% terms.bug %] to yourself, check the box below.
    - [% IF bug.assigned_to.login == "nobody@mozilla.org" || bug.assigned_to.login.search('@(?!invalid).+\.bugs$') %] + [% IF bug.assigned_to.login == Bugzilla.params.nobody_user || bug.assigned_to.login.search('@(?!invalid).+\.bugs$') %] [% take_if_patch = 1 %] [% END %] From b7abfa9f9aa790f99f1e2c121fb6b8df35bad4dd Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 18 Mar 2018 07:01:24 +0200 Subject: [PATCH 13/19] Bug 1446236 - edit-multiple.html.tmpl: Delete an old user-specific hard-coded hack --- template/en/default/list/edit-multiple.html.tmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/template/en/default/list/edit-multiple.html.tmpl b/template/en/default/list/edit-multiple.html.tmpl index 0e3f282e0c..58e54a335d 100644 --- a/template/en/default/list/edit-multiple.html.tmpl +++ b/template/en/default/list/edit-multiple.html.tmpl @@ -466,7 +466,6 @@ [% FOREACH r = resolutions %] [% NEXT IF !r %] [% NEXT IF r == "DUPLICATE" || r == "MOVED" %] - [% NEXT IF r == "EXPIRED" AND user.login != "gerv@mozilla.org" %] [% END %] From f344c5221202f04088c0a69aee2b92ebd24a336d Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 18 Mar 2018 08:05:33 +0200 Subject: [PATCH 14/19] Bug 1446236 - error pages fixups --- .gitignore | 2 ++ Bugzilla/Install/Filesystem.pm | 1 + 2 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 1159a5a557..9a72d60793 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,9 @@ /data /localconfig /localconfig.* +/conf/env.conf /index.html +/errors/ /error_reports /.DS_Store /template_cache diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index 10e9a38a69..b4bae4cdda 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -390,6 +390,7 @@ sub FILESYSTEM { ); # Create static error pages. + $create_dirs{"errors"} = DIR_CGI_READ; $create_files{"errors/401.html"} = { perms => CGI_READ, overwrite => 1, From f0b8f4f328dbbd70eaa50f71205df33f6e3f4b33 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 8 Apr 2018 06:57:06 +0300 Subject: [PATCH 15/19] Bug 1446236 - Add & use simpler method to check if an extension is present (#35) --- Bugzilla.pm | 19 +++++++++++++++++++ Bugzilla/Search.pm | 7 ++----- extensions/BugModal/Extension.pm | 4 +--- votes.cgi | 3 +-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Bugzilla.pm b/Bugzilla.pm index 01c5d03dee..6725488c12 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -125,6 +125,14 @@ sub template_inner { } sub extensions { + # Guard against extensions querying the extension list during initialization + # (through this method or has_extension). + # The extension list is not fully populated at that point, + # so the results would not be meaningful. + state $recursive = 0; + die "Recursive attempt to load/query extensions" if $recursive; + $recursive = 1; + state $extensions; return $extensions if $extensions; my $extension_packages = Bugzilla::Extension->load_all(); @@ -134,9 +142,20 @@ sub extensions { push @$extensions, $package; } } + $recursive = 0; return $extensions; } +sub has_extension { + my ($class, $name) = @_; + my $cache = $class->request_cache; + if (!$cache->{extensions_hash}) { + my %extensions = map { $_->NAME => 1 } @{Bugzilla->extensions}; + $cache->{extensions_hash} = \%extensions; + } + return exists $cache->{extensions_hash}{$name}; +} + sub cgi { return request_cache->{cgi} ||= Bugzilla::CGI->new; } diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 9c7b6d82eb..a221d79b33 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -34,7 +34,6 @@ use Date::Format; use Date::Parse; use Scalar::Util qw(blessed); use List::MoreUtils qw(all firstidx part uniq); -use List::Util qw(any); use POSIX qw(INT_MAX); use Storable qw(dclone); use Time::HiRes qw(gettimeofday tv_interval); @@ -803,9 +802,7 @@ sub data { # BMO - to avoid massive amounts of joins, if we're selecting a lot of # tracking flags, replace them with placeholders. the values will be # retrieved later and injected into the result. - state $have_tracking_flags - = any { $_->NAME eq 'TrackingFlags' } @{Bugzilla->extensions}; - if ($have_tracking_flags) { + if (Bugzilla->has_extension('TrackingFlags')) { my %tf_map = map { $_ => 1 } Bugzilla->tracking_flag_names; my @tf_selected = grep { exists $tf_map{$_} } @orig_fields; @@ -874,7 +871,7 @@ sub data { $self->{data} = [map { $data{$_} } @$bug_ids]; # BMO - get tracking flags values, and insert into result - if ($have_tracking_flags && @{$self->{tracking_flags}}) { + if (Bugzilla->has_extension('TrackingFlags') && @{$self->{tracking_flags}}) { # read values my $values; diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm index 7bd67649f4..d4679d87ff 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -197,9 +197,7 @@ sub template_before_process { return if exists $bug->{error}; # trigger loading of tracking flags - state $have_tracking_flags - = any { $_->NAME eq 'TrackingFlags' } @{Bugzilla->extensions}; - if ($have_tracking_flags) { + if (Bugzilla->has_extension('TrackingFlags')) { Bugzilla::Extension::TrackingFlags->template_before_process({ file => 'bug/edit.html.tmpl', vars => $vars, }); diff --git a/votes.cgi b/votes.cgi index 57912cd771..3cebfad37c 100755 --- a/votes.cgi +++ b/votes.cgi @@ -30,8 +30,7 @@ use lib qw(. lib local/lib/perl5); use Bugzilla; use Bugzilla::Error; -my $is_enabled = grep { $_->NAME eq 'Voting' } @{Bugzilla->extensions}; -$is_enabled || ThrowCodeError('extension_disabled', {name => 'Voting'}); +Bugzilla->has_extension('Voting') || ThrowCodeError('extension_disabled', { name => 'Voting' }); my $cgi = Bugzilla->cgi; my $action = $cgi->param('action') || 'show_user'; From 7c1a336a0878a2a396844c653f7d7963c5304eba Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 8 Apr 2018 19:06:28 +0300 Subject: [PATCH 16/19] table.html.tmpl: Use order_columns only when present (#23) Fix a hard dependency on the BMO extension. order_columns is set in Bugzilla::Extension::BMO, which might not be present / loaded. --- template/en/default/list/table.html.tmpl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/template/en/default/list/table.html.tmpl b/template/en/default/list/table.html.tmpl index 86aca78ed1..d6c05c9e9a 100644 --- a/template/en/default/list/table.html.tmpl +++ b/template/en/default/list/table.html.tmpl @@ -102,7 +102,9 @@   [% END %] + [% order_columns.defined + ? 'sorted_' _ lsearch(order_columns, 'bug_id') + : '' FILTER html %]"> + [% order_columns.defined + ? 'sorted_' _ lsearch(order_columns, id) + : '' FILTER html %]"> ', YAHOO.widget.DataTable.CLASS_LOADING ); @@ -150,7 +150,7 @@ YAHOO.bugzilla.instantSearch = { var result = []; var name = Dom.get('product').value; result.push(name); - if (products[name] && products[name].related) { + if (typeof products !== 'undefined' && products[name] && products[name].related) { for (var i = 0, n = products[name].related.length; i < n; i++) { result.push(products[name].related[i]); } diff --git a/template/en/default/search/search-instant.html.tmpl b/template/en/default/search/search-instant.html.tmpl index b36ac98f54..b677d547c5 100644 --- a/template/en/default/search/search-instant.html.tmpl +++ b/template/en/default/search/search-instant.html.tmpl @@ -8,11 +8,15 @@ [% PROCESS global/variables.none.tmpl %] +[% javascript_urls = [ 'js/instant-search.js' ] %] +[% IF has_extension('GuidedBugEntry') %] + [% javascript_urls.import(['extensions/GuidedBugEntry/web/js/products.js']); %] +[% END %] + [% PROCESS global/header.html.tmpl title = "Instant Search" generate_api_token = 1 - javascript_urls = [ 'extensions/GuidedBugEntry/web/js/products.js', - 'js/instant-search.js', ] + javascript_urls = javascript_urls %] [% UNLESS default.exists('product') && default.product.size %] From a21b7bbf8f49371013da714b0dfb580adc540d72 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 8 Apr 2018 19:12:10 +0300 Subject: [PATCH 19/19] search-google.html.tmpl: Calculate sitesearch from urlbase (#20) --- template/en/default/search/search-google.html.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/en/default/search/search-google.html.tmpl b/template/en/default/search/search-google.html.tmpl index 7fdc1daaa1..1b07320ce5 100644 --- a/template/en/default/search/search-google.html.tmpl +++ b/template/en/default/search/search-google.html.tmpl @@ -32,7 +32,7 @@

    - +