diff options
Diffstat (limited to 'extensions')
42 files changed, 137 insertions, 80 deletions
diff --git a/extensions/AntiSpam/lib/Config.pm b/extensions/AntiSpam/lib/Config.pm index e35a7f001..278baea8f 100644 --- a/extensions/AntiSpam/lib/Config.pm +++ b/extensions/AntiSpam/lib/Config.pm @@ -55,7 +55,7 @@ sub get_param_list { "This account has been automatically disabled as a result of " . "a high number of comments tagged as abusive.<br>\n<br>\n" . "All interactions on Bugzilla should follow our " . - "<a href=\"https://bugzilla.mozilla.org/page.cgi?id=etiquette.html\">" . + "<a href=\"" . Bugzilla->localconfig->{'urlbase'} . "page.cgi?id=etiquette.html\">" . "etiquette guidelines</a>.<br>\n<br>\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 3b1c03eec..d2e62eccd 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -46,6 +46,7 @@ use Bugzilla::User; use Bugzilla::UserAgent qw(detect_platform detect_op_sys); use Bugzilla::User::Setting; use Bugzilla::Util; +use Bugzilla::PSGI qw(compile_cgi); use Date::Parse; use DateTime; @@ -878,7 +879,7 @@ 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' }) + my $sharer = Bugzilla::User->new({ name => Bugzilla->params->{'nobody_user'} }) or return; my $group = Bugzilla::Group->new({ name => 'everyone' }) or return; @@ -919,7 +920,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 =~ /\.bugs$/; + return $assignee eq Bugzilla->params->{'nobody_user'} || $assignee =~ /\.bugs$/; } sub _bug_has_current_patch { @@ -1100,7 +1101,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' + $new_bug->assigned_to->login eq Bugzilla->params->{'nobody_user'} || $new_bug->assigned_to->login =~ /\.bugs$/; # and the user can set the status to NEW @@ -1595,7 +1596,7 @@ sub field_end_of_create { my $name = $field->name; if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) { - Bugzilla->set_user(Bugzilla::User->check({ name => 'nobody@mozilla.org' })); + Bugzilla->set_user(Bugzilla::User->check({ name => Bugzilla->params->{'nobody_user'} })); print "Creating IT permission grant bug for new field '$name'..."; } @@ -1666,6 +1667,28 @@ sub webservice { $dispatch->{BMO} = "Bugzilla::Extension::BMO::WebService"; } +sub psgi_builder { + my ($self, $args) = @_; + my $mount = $args->{mount}; + + my $ses_index = Plack::Builder::builder(sub { + my $auth_user = Bugzilla->localconfig->{ses_username}; + my $auth_pass = Bugzilla->localconfig->{ses_password}; + Plack::Builder::enable("Auth::Basic", authenticator => sub { + my ($username, $password, $env) = @_; + return ( $auth_user + && $auth_pass + && $username + && $password + && $username eq $auth_user + && $password eq $auth_pass ); + }); + compile_cgi("ses/index.cgi"); + }); + + $mount->{'ses/index.cgi'} = $ses_index; +} + our $search_content_matches; BEGIN { $search_content_matches = \&Bugzilla::Search::_content_matches; @@ -1951,7 +1974,7 @@ 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 735c6a37a..fd891f4ae 100755 --- a/extensions/BMO/bin/bug_1093952.pl +++ b/extensions/BMO/bin/bug_1093952.pl @@ -52,7 +52,7 @@ printf "About to fix %s bugs\n", scalar(@$bugs); print "Press <Ctrl-C> to stop or <Enter> 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/bug_1141452.pl b/extensions/BMO/bin/bug_1141452.pl index 869593802..155c4704c 100755 --- a/extensions/BMO/bin/bug_1141452.pl +++ b/extensions/BMO/bin/bug_1141452.pl @@ -50,7 +50,7 @@ printf "About to fix %s bugs\n", scalar(@$flags); print "Press <Ctrl-C> to stop or <Enter> to continue...\n"; getc(); -my $nobody = Bugzilla::User->check({ name => 'nobody@mozilla.org' }); +my $nobody = Bugzilla::User->check({ name => Bugzilla->params->{'nobody_user'} }); my $when = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)'); $dbh->bz_start_transaction(); diff --git a/extensions/BMO/bin/migrate-github-pull-requests.pl b/extensions/BMO/bin/migrate-github-pull-requests.pl index 53c1727b5..c39778a4a 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::User; 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/disabled b/extensions/BMO/disabled new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/extensions/BMO/disabled diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm index 4df05581c..30a32c95e 100644 --- a/extensions/BMO/lib/Data.pm +++ b/extensions/BMO/lib/Data.pm @@ -109,12 +109,11 @@ tie(%$cf_visible_in_products, "Tie::IxHash", "Calendar" => [], "Composer" => [], "Core" => [], + "DevTools" => [], "Directory" => [], "External Software Affecting Firefox" => [], "Firefox" => [], "Firefox for Android" => [], - "Firefox for Metro" => [], - "Firefox OS" => [], "JSS" => [], "MailNews Core" => [], "Mozilla Labs" => [], @@ -133,6 +132,7 @@ tie(%$cf_visible_in_products, "Tie::IxHash", "Testing" => [], "Thunderbird" => [], "Toolkit" => [], + "WebExtensions" => [], }, qr/^cf_due_date$/ => { "bugzilla.mozilla.org" => [], diff --git a/extensions/BMO/lib/WebService.pm b/extensions/BMO/lib/WebService.pm index 327c8563f..b9d8e4132 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-mozpr.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-mozpr.html.tmpl index 697542ead..0bd1c94d7 100644 --- a/extensions/BMO/template/en/default/bug/create/create-mozpr.html.tmpl +++ b/extensions/BMO/template/en/default/bug/create/create-mozpr.html.tmpl @@ -297,7 +297,7 @@ function validate_form() { <input type="hidden" name="version" value="unspecified"> <input type="hidden" name="bug_severity" value="normal"> <input type="hidden" name="group" value="pr-private"> -<input type="hidden" name="assigned_to" id="assigned_to" value="nobody@mozilla.org"> +<input type="hidden" name="assigned_to" id="assigned_to" value="[% Param('nobody_user') FILTER html %]"> <input type="hidden" name="token" value="[% token FILTER html %]"> <div class="head"> diff --git a/extensions/BMO/template/en/default/bug/create/create-poweredby.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-poweredby.html.tmpl index d6243c73b..9c0c4780d 100644 --- a/extensions/BMO/template/en/default/bug/create/create-poweredby.html.tmpl +++ b/extensions/BMO/template/en/default/bug/create/create-poweredby.html.tmpl @@ -43,7 +43,7 @@ please provide some information about your application or product.</p> <input type="hidden" name="priority" value="--"> <input type="hidden" name="op_sys" value="Other"> <input type="hidden" name="version" value="unspecified"> - <input type="hidden" name="assigned_to" value="nobody@mozilla.org"> + <input type="hidden" name="assigned_to" value="[% Param('nobody_user') FILTER html %]"> <input type="hidden" name="cc" value="liz@mozilla.com"> <input type="hidden" name="groups" value="marketing-private"> <input type="hidden" name="token" value="[% token FILTER html %]"> 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 92517cb80..803f2a746 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 @@ -88,7 +88,7 @@ function validateAndSubmit() { <input type="hidden" name="token" value="[% token FILTER html %]"> <div class="head_desc"> - <a href="https://developer.mozilla.org/docs/Mozilla/QA/Bug_writing_guidelines"> + <a href="[% terms.BugWritingGuidelinesURL %]"> [% terms.Bug %] writing guidelines</a> </div> 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 6ecd0bc75..d3c7412bf 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 - <a href="https://developer.mozilla.org/docs/Mozilla/QA/Bug_writing_guidelines"> + <a href="[% terms.BugWritingGuidelinesURL %]"> [% terms.bug %] writing guidelines</a> and double checked that your [% terms.bug %] hasn't already been reported. Consult our list of <a href="https://bugzilla.mozilla.org/duplicates.cgi"> most frequently reported [% terms.bugs %]</a> and <a href="https://bugzilla.mozilla.org/query.cgi"> 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 e1c67605f..dc253ee03 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 45dd5bd65..fe7d2cd3d 100644 --- a/extensions/BMO/template/en/default/pages/etiquette.html.tmpl +++ b/extensions/BMO/template/en/default/pages/etiquette.html.tmpl @@ -173,7 +173,7 @@ <h2>See Also</h2> <p> - <a href="https://developer.mozilla.org/docs/Mozilla/QA/Bug_writing_guidelines">The [% terms.Bug %] Writing Guidelines</a>. + <a href="[% terms.BugWritingGuidelinesURL %]">The [% terms.Bug %] Writing Guidelines</a>. </p> [% 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 cfa3bd3ea..838a1e84a 100644 --- a/extensions/BMO/template/en/default/pages/group_admins.html.tmpl +++ b/extensions/BMO/template/en/default/pages/group_admins.html.tmpl @@ -39,7 +39,7 @@ [% group.name FILTER html %]</span> </td> <td nowrap> - [% IF group.owner.login == 'nobody@mozilla.org' %] + [% IF group.owner.login == Param('nobody_user') %] – [% ELSE %] [% INCLUDE global/user.html.tmpl who = group.owner %] diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm index 1291fca21..ef9c93a37 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -188,10 +188,12 @@ 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 b61e742b4..48c2c1803 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 == Param('nobody_user')) || (bug.assigned_to.login.search('\.bugs$')); # custom fields that have custom rendering, or should not be rendered diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index d232c172a..4a770e66c 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -1423,7 +1423,7 @@ function show_new_changes_indicator() { observer.unobserve($separator); $link.remove(); } - }), { root: $separator.offsetParent }); + }), { root: document.querySelector('#bugzilla-body') }); observer.observe($separator); } diff --git a/extensions/BzAPI/Extension.pm b/extensions/BzAPI/Extension.pm index bb9805134..1f7cce04a 100644 --- a/extensions/BzAPI/Extension.pm +++ b/extensions/BzAPI/Extension.pm @@ -15,6 +15,7 @@ use base qw(Bugzilla::Extension); use Bugzilla::Extension::BzAPI::Constants; use Bugzilla::Extension::BzAPI::Util qw(fix_credentials filter_wants_nocache); +use Bugzilla::PSGI qw(compile_cgi); use Bugzilla::Error; use Bugzilla::Util qw(trick_taint datetime_from); @@ -188,6 +189,14 @@ sub webservice_status_code_map { $status_code_map->{51} = STATUS_BAD_REQUEST; } +sub psgi_builder { + my ($self, $args) = @_; + my $mount = $args->{mount}; + + $mount->{'bzapi'} = compile_cgi('extensions/BzAPI/bin/rest.cgi'); +} + + ##################### # Utility Functions # ##################### diff --git a/extensions/ComponentWatching/Extension.pm b/extensions/ComponentWatching/Extension.pm index 01d843c7a..ed47e64c3 100644 --- a/extensions/ComponentWatching/Extension.pm +++ b/extensions/ComponentWatching/Extension.pm @@ -23,7 +23,7 @@ use Bugzilla::Util qw(detaint_natural trim trick_taint); our $VERSION = '2'; use constant REQUIRE_WATCH_USER => 1; -use constant DEFAULT_ASSIGNEE => 'nobody@mozilla.org'; +use constant DEFAULT_ASSIGNEE => Bugzilla->params->{'nobody_user'}; use constant REL_COMPONENT_WATCHER => 15; @@ -158,7 +158,9 @@ sub object_columns { my $columns = $args->{columns}; return unless $class->isa('Bugzilla::Component'); - push(@$columns, 'watch_user'); + if (Bugzilla->dbh->bz_column_info($class->DB_TABLE, 'watch_user')) { + push @$columns, 'watch_user'; + } } sub object_update_columns { diff --git a/extensions/ContributorEngagement/Extension.pm b/extensions/ContributorEngagement/Extension.pm index 949517ecf..35eba24ab 100644 --- a/extensions/ContributorEngagement/Extension.pm +++ b/extensions/ContributorEngagement/Extension.pm @@ -70,7 +70,10 @@ sub object_columns { my ($self, $args) = @_; my ($class, $columns) = @$args{qw(class columns)}; if ($class->isa('Bugzilla::User')) { - push(@$columns, 'first_patch_reviewed_id'); + my $dbh = Bugzilla->dbh; + if ($dbh->bz_column_info($class->DB_TABLE, 'first_patch_reviewed_id')) { + push @$columns, 'first_patch_reviewed_id'; + } } } diff --git a/extensions/EditComments/Extension.pm b/extensions/EditComments/Extension.pm index ab19ab6e7..e2ace3f23 100644 --- a/extensions/EditComments/Extension.pm +++ b/extensions/EditComments/Extension.pm @@ -191,7 +191,9 @@ sub object_columns { my ($self, $args) = @_; my ($class, $columns) = @$args{qw(class columns)}; if ($class->isa('Bugzilla::Comment')) { - push(@$columns, 'edit_count'); + if (Bugzilla->dbh->bz_column_info($class->DB_TABLE, 'edit_count')) { + push @$columns, 'edit_count'; + } } } diff --git a/extensions/EditComments/lib/WebService.pm b/extensions/EditComments/lib/WebService.pm index 6969ca742..5fdd6ffee 100644 --- a/extensions/EditComments/lib/WebService.pm +++ b/extensions/EditComments/lib/WebService.pm @@ -88,7 +88,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 10c828537..2e00773f2 100644 --- a/extensions/Ember/lib/WebService.pm +++ b/extensions/Ember/lib/WebService.pm @@ -781,7 +781,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/FlagTypeComment/Extension.pm b/extensions/FlagTypeComment/Extension.pm index 3ec506176..e7b34113d 100644 --- a/extensions/FlagTypeComment/Extension.pm +++ b/extensions/FlagTypeComment/Extension.pm @@ -127,13 +127,18 @@ sub _set_ftc_states { 'active_or_has_flags' => $bug->id, }); - my $types = join(',', map { $_->id } @$flag_types); - my $states = "'" . join("','", FLAGTYPE_COMMENT_STATES) . "'"; - $db_result = $dbh->selectall_arrayref( - "SELECT type_id AS flagtype, on_status AS state, comment AS text - FROM flagtype_comments - WHERE type_id IN ($types) AND on_status IN ($states)", - { Slice => {} }); + if (@$flag_types) { + my $types = join(',', map { $_->id } @$flag_types); + my $states = "'" . join("','", FLAGTYPE_COMMENT_STATES) . "'"; + $db_result = $dbh->selectall_arrayref( + "SELECT type_id AS flagtype, on_status AS state, comment AS text + FROM flagtype_comments + WHERE type_id IN ($types) AND on_status IN ($states)", + { Slice => {} }); + } + else { + $db_result = []; + } } foreach my $row (@$db_result) { diff --git a/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl b/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl index e1a9e0bc5..7ffa04922 100644 --- a/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl +++ b/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl @@ -356,7 +356,7 @@ Product: <b><span id="dupes_product_name">?</span></b>: <ul> <li>Please fill out this form clearly, precisely and in as much detail as you can manage.</li> <li>Please report only a single problem at a time.</li> -<li><a href="https://developer.mozilla.org/docs/Mozilla/QA/Bug_writing_guidelines" target="_blank" rel="noopener noreferrer">These guidelines</a> +<li><a href="[% terms.BugWritingGuidelinesURL %]" target="_blank" rel="noopener noreferrer">These guidelines</a> explain how to write effective [% terms.bug %] reports.</li> </ul> diff --git a/extensions/MyDashboard/lib/WebService.pm b/extensions/MyDashboard/lib/WebService.pm index 5407c1d0b..5ab849350 100644 --- a/extensions/MyDashboard/lib/WebService.pm +++ b/extensions/MyDashboard/lib/WebService.pm @@ -172,7 +172,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/disabled b/extensions/PhabBugz/disabled new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/extensions/PhabBugz/disabled diff --git a/extensions/PhabBugz/lib/Feed.pm b/extensions/PhabBugz/lib/Feed.pm index 72829f179..c46d36c13 100644 --- a/extensions/PhabBugz/lib/Feed.pm +++ b/extensions/PhabBugz/lib/Feed.pm @@ -322,9 +322,10 @@ sub group_query { # Make sure phab-bot also a member of the new project group so that it can # make policy changes to the private revisions - INFO("Setting group members for " . $project->name); - my @group_members = $self->get_group_members( $group ); - $project->set_members( [ ($phab_user, @group_members) ] ); + INFO("Setting project members for " . $project->name); + my $set_members = $self->get_group_members( $group ); + push @$set_members, $phab_user unless grep $_->phid eq $phab_user->phid, @$set_members; + $project->set_members( $set_members ); $project->update(); } } @@ -477,7 +478,7 @@ sub process_revision_change { phids => \@accepted_phids } ); - @accepted_user_ids = map { $_->bugzilla_user->id } @$phab_users; + @accepted_user_ids = map { $_->bugzilla_user->id } grep { defined $_->bugzilla_user } @$phab_users; } if ( @denied_phids ) { @@ -486,7 +487,7 @@ sub process_revision_change { phids => \@denied_phids } ); - @denied_user_ids = map { $_->bugzilla_user->id } @$phab_users; + @denied_user_ids = map { $_->bugzilla_user->id } grep { defined $_->bugzilla_user } @$phab_users; } my %reviewers_hash = map { $_->name => 1 } @{ $revision->reviewers }; @@ -780,25 +781,24 @@ sub get_group_members { my $group_obj = ref $group ? $group : Bugzilla::Group->check( { name => $group, cache => 1 } ); - my $members_all = $group_obj->members_complete(); - my @userids; - foreach my $name ( keys %$members_all ) { - foreach my $user ( @{ $members_all->{$name} } ) { - push @userids, $user->id; - } - } + my $flat_list = join(',', + @{ Bugzilla::Group->flatten_group_membership( $group_obj->id ) } ); - return if !@userids; + my $user_query = " + SELECT DISTINCT profiles.userid + FROM profiles, user_group_map AS ugm + WHERE ugm.user_id = profiles.userid + AND ugm.isbless = 0 + AND ugm.group_id IN($flat_list)"; + my $user_ids = Bugzilla->dbh->selectcol_arrayref($user_query); - # Look up the phab ids for these users - my $phab_users = Bugzilla::Extension::PhabBugz::User->match( + # Return matching users in Phabricator + return Bugzilla::Extension::PhabBugz::User->match( { - ids => \@userids + ids => $user_ids } ); - - return map { $_->phid } @$phab_users; } 1; diff --git a/extensions/PhabBugz/lib/Revision.pm b/extensions/PhabBugz/lib/Revision.pm index a39e7169c..900454220 100644 --- a/extensions/PhabBugz/lib/Revision.pm +++ b/extensions/PhabBugz/lib/Revision.pm @@ -476,15 +476,8 @@ sub make_private { sub make_public { my ( $self ) = @_; - my $edit_bugs = - Bugzilla::Extension::PhabBugz::Project->new_from_query( - { - name => 'bmo-editbugs-team' - } - ); - $self->set_policy('view', 'public'); - $self->set_policy('edit', ($edit_bugs ? $edit_bugs->phid : 'users')); + $self->set_policy('edit', 'users'); my @current_group_projects = grep { $_->name =~ /^(bmo-.*|secure-revision)$/ } @{ $self->projects }; foreach my $project (@current_group_projects) { diff --git a/extensions/PhabBugz/lib/Util.pm b/extensions/PhabBugz/lib/Util.pm index 214bc3fb7..d25f62f68 100644 --- a/extensions/PhabBugz/lib/Util.pm +++ b/extensions/PhabBugz/lib/Util.pm @@ -107,7 +107,7 @@ sub get_bug_role_phids { my @bug_users = ( $bug->reporter ); push(@bug_users, $bug->assigned_to) - if $bug->assigned_to->email !~ /^nobody\@mozilla\.org$/; + if $bug->assigned_to->email != Bugzilla->params->{'nobody_user'}; push(@bug_users, $bug->qa_contact) if $bug->qa_contact; push(@bug_users, @{ $bug->cc_users }) if @{ $bug->cc_users }; diff --git a/extensions/Push/disabled b/extensions/Push/disabled new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/extensions/Push/disabled diff --git a/extensions/RestrictComments/Extension.pm b/extensions/RestrictComments/Extension.pm index 213a1c44a..e93540d5a 100644 --- a/extensions/RestrictComments/Extension.pm +++ b/extensions/RestrictComments/Extension.pm @@ -68,7 +68,9 @@ sub object_columns { my ($self, $args) = @_; my ($class, $columns) = @$args{qw(class columns)}; if ($class->isa('Bugzilla::Bug')) { - push(@$columns, 'restrict_comments'); + if (Bugzilla->dbh->bz_column_info($class->DB_TABLE, 'restrict_comments')) { + push @$columns, 'restrict_comments'; + } } } diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm index 47edd69a6..72f16e3b6 100644 --- a/extensions/Review/Extension.pm +++ b/extensions/Review/Extension.pm @@ -284,10 +284,14 @@ sub object_columns { my ($self, $args) = @_; my ($class, $columns) = @$args{qw(class columns)}; if ($class->isa('Bugzilla::Product')) { - push @$columns, 'reviewer_required'; + my $dbh = Bugzilla->dbh; + my @new_columns = qw(reviewer_required); + push @$columns, grep { $dbh->bz_column_info($class->DB_TABLE, $_) } @new_columns; } elsif ($class->isa('Bugzilla::User')) { - push @$columns, qw(review_request_count feedback_request_count needinfo_request_count); + my $dbh = Bugzilla->dbh; + my @new_columns = qw(review_request_count feedback_request_count needinfo_request_count); + push @$columns, grep { $dbh->bz_column_info($class->DB_TABLE, $_) } @new_columns; } } diff --git a/extensions/Review/bin/migrate_mentor_from_whiteboard.pl b/extensions/Review/bin/migrate_mentor_from_whiteboard.pl index c6b69006f..debf173a7 100755 --- a/extensions/Review/bin/migrate_mentor_from_whiteboard.pl +++ b/extensions/Review/bin/migrate_mentor_from_whiteboard.pl @@ -36,7 +36,7 @@ EOF <>; # 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 3f6816916..0c54d725a 100644 --- a/extensions/Review/lib/WebService.pm +++ b/extensions/Review/lib/WebService.pm @@ -51,7 +51,7 @@ sub suggestions { # we always need to be authentiated 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); } else { diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm index 508b1f5e8..2b5e1bdd6 100644 --- a/extensions/SecureMail/Extension.pm +++ b/extensions/SecureMail/Extension.pm @@ -104,7 +104,10 @@ sub object_columns { my $columns = $args->{'columns'}; if ($class->isa('Bugzilla::Group')) { - push(@$columns, 'secure_mail'); + my $dbh = Bugzilla->dbh; + if ($dbh->bz_column_info($class->DB_TABLE, 'secure_mail')) { + push @$columns, 'secure_mail'; + } } } diff --git a/extensions/TagNewUsers/Extension.pm b/extensions/TagNewUsers/Extension.pm index b94873979..1810f204f 100644 --- a/extensions/TagNewUsers/Extension.pm +++ b/extensions/TagNewUsers/Extension.pm @@ -123,7 +123,9 @@ sub object_columns { my ($self, $args) = @_; my ($class, $columns) = @$args{qw(class columns)}; if ($class->isa('Bugzilla::User')) { - push(@$columns, qw(comment_count creation_ts first_patch_bug_id)); + my $dbh = Bugzilla->dbh; + my @new_columns = qw(comment_count creation_ts first_patch_bug_id); + push @$columns, grep { $dbh->bz_column_info($class->DB_TABLE, $_) } @new_columns; } } @@ -131,9 +133,14 @@ sub object_before_create { my ($self, $args) = @_; my ($class, $params) = @$args{qw(class params)}; if ($class->isa('Bugzilla::User')) { - my ($timestamp) = Bugzilla->dbh->selectrow_array("SELECT NOW()"); - $params->{comment_count} = 0; - $params->{creation_ts} = $timestamp; + my $dbh = Bugzilla->dbh; + my ($timestamp) = $dbh->selectrow_array("SELECT NOW()"); + if ($dbh->bz_column_info($class->DB_TABLE, 'comment_count')) { + $params->{comment_count} = 0; + } + if ($dbh->bz_column_info($class->DB_TABLE, 'creation_ts')) { + $params->{creation_ts} = $timestamp; + } } elsif ($class->isa('Bugzilla::Attachment')) { if ($params->{ispatch} && !Bugzilla->user->first_patch_bug_id) { Bugzilla->user->first_patch_bug_id($params->{bug}->id); diff --git a/extensions/TrackingFlags/bin/bug_825946.pl b/extensions/TrackingFlags/bin/bug_825946.pl index 3f380b7ac..896dc5448 100755 --- a/extensions/TrackingFlags/bin/bug_825946.pl +++ b/extensions/TrackingFlags/bin/bug_825946.pl @@ -24,7 +24,7 @@ use Bugzilla::Bug qw(LogActivityEntry); 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(<<SQL); SELECT diff --git a/extensions/TrackingFlags/bin/bulk_flag_clear.pl b/extensions/TrackingFlags/bin/bulk_flag_clear.pl index 1745018d5..305fbf883 100755 --- a/extensions/TrackingFlags/bin/bulk_flag_clear.pl +++ b/extensions/TrackingFlags/bin/bulk_flag_clear.pl @@ -110,7 +110,7 @@ if (!$config->{update_db}) { # update bugs -my $nobody = Bugzilla::User->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]; Bugzilla->set_user($nobody); diff --git a/extensions/TrackingFlags/disabled b/extensions/TrackingFlags/disabled new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/extensions/TrackingFlags/disabled diff --git a/extensions/UserProfile/Extension.pm b/extensions/UserProfile/Extension.pm index 079f7a948..9171b942d 100644 --- a/extensions/UserProfile/Extension.pm +++ b/extensions/UserProfile/Extension.pm @@ -385,7 +385,9 @@ sub object_columns { my ($self, $args) = @_; my ($class, $columns) = @$args{qw(class columns)}; if ($class->isa('Bugzilla::User')) { - push(@$columns, qw(last_activity_ts last_statistics_ts)); + my $dbh = Bugzilla->dbh; + my @new_columns = qw(last_activity_ts last_statistics_ts); + push @$columns, grep { $dbh->bz_column_info($class->DB_TABLE, $_) } @new_columns; } } |