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.pm b/Bugzilla.pm index 99388f609c..6725488c12 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); @@ -124,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(); @@ -133,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; } @@ -162,6 +182,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/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/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index baa06ad3a9..b4bae4cdda 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,47 @@ sub FILESYSTEM { {perms => CGI_READ, overwrite => 1, contents => $yui3_all_css}, ); + # Create static error pages. + $create_dirs{"errors"} = DIR_CGI_READ; + $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', { @@ -417,7 +503,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"); diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 7afcaf77bf..a221d79b33 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -802,19 +802,21 @@ 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} = "'---'"; + if (Bugzilla->has_extension('TrackingFlags')) { + 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 +871,7 @@ sub data { $self->{data} = [map { $data{$_} } @$bug_ids]; # BMO - get tracking flags values, and insert into result - if (@{$self->{tracking_flags}}) { + if (Bugzilla->has_extension('TrackingFlags') && @{$self->{tracking_flags}}) { # read values my $values; diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 59de9eac40..58e4bee064 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; }, @@ -1058,6 +1058,8 @@ sub create { 'feature_enabled' => sub { return Bugzilla->feature(@_); }, + 'has_extension' => sub { return Bugzilla->has_extension(@_); }, + # field_descs can be somewhat slow to generate, so we generate # it only once per-language no matter how many times # $template->process() is called. 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 diff --git a/enter_bug.cgi b/enter_bug.cgi index 64f6d152e6..b4795f9ee1 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -37,6 +37,8 @@ use Bugzilla::Field; use Bugzilla::Status; use Bugzilla::UserAgent; +use List::Util qw(any); + my $user = Bugzilla->login(LOGIN_REQUIRED); my $cloned_bug; @@ -322,10 +324,15 @@ else { = formvalue('bug_severity', Bugzilla->params->{'defaultseverity'}); # BMO - use per-product default hw/os - $default{'rep_platform'} - = formvalue('rep_platform', $product->default_platform // detect_platform()); - $default{'op_sys'} - = formvalue('op_sys', $product->default_op_sys // detect_op_sys()); + if (any { $_->NAME eq 'BMO' } @{ Bugzilla->extensions }) { + $default{'rep_platform'} + = formvalue('rep_platform', $product->default_platform // detect_platform()); + $default{'op_sys'} + = formvalue('op_sys', $product->default_op_sys // detect_op_sys()); + } else { + $default{'rep_platform'} = formvalue('rep_platform', detect_platform()); + $default{'op_sys'} = formvalue('op_sys', detect_op_sys()); + } $vars->{'rep_platform'} = detect_platform(); $vars->{'rep_op_sys'} = detect_op_sys(); 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

-
- - 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 " 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/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/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..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 @@ -17,10 +17,10 @@ [% 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 + been reported. Consult our list of + most frequently reported [% terms.bugs %] and search through descriptions of previously reported [% terms.bugs %]. [% END %]

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/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/Extension.pm b/extensions/BugModal/Extension.pm index a484c559b9..d4679d87ff 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -197,9 +197,11 @@ 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, - }); + if (Bugzilla->has_extension('TrackingFlags')) { + 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}; 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/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/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/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 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/js/instant-search.js b/js/instant-search.js index 0007aecf3f..6ca3a977a5 100644 --- a/js/instant-search.js +++ b/js/instant-search.js @@ -108,7 +108,7 @@ YAHOO.bugzilla.instantSearch = { YAHOO.bugzilla.instantSearch.dataTable.showTableMessage( 'Searching...   ' + - `', 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/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/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.

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 %] 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') %] 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 %] 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 %]"> - + 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 %] 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';