Skip to content

Commit

Permalink
Merge branch 'master' into have-extension
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow authored Nov 3, 2020
2 parents a6cd1ba + 22f3a48 commit f130a48
Show file tree
Hide file tree
Showing 28 changed files with 47 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Bugzilla/Install/DB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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('[email protected]');
my $nobody = Bugzilla::User->check(Bugzilla->localconfig->nobody_user);
$dbh->do('UPDATE groups SET owner_user_id = ?', undef, $nobody->id);
}

Expand Down
1 change: 1 addition & 0 deletions Bugzilla/Install/Localconfig.pm
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ use constant LOCALCONFIG_VARS => (
{name => 'memcached_namespace', default => "bugzilla:",},
{name => 'urlbase', default => '',},
{name => 'canonical_urlbase', lazy => 1},
{name => 'nobody_user', default => '[email protected]'},
{name => 'attachment_base', default => '',},
{name => 'ses_username', default => '',},
{name => 'ses_password', default => '',},
Expand Down
3 changes: 2 additions & 1 deletion Bugzilla/Test/MockParams.pm
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ sub import {
$answers{user_info_class} //= 'GitHubAuth,CGI';
$answers{user_verify_class} //= 'GitHubAuth,DB';

if ($first_time++) {
if ($first_time++ == 0) {
capture_merged {
Bugzilla::Config::update_params();
};
}
else {
Bugzilla::Config::SetParam($_, $answers{$_}) for keys %answers;
Bugzilla::Config::write_params();
}
}

Expand Down
10 changes: 6 additions & 4 deletions extensions/BMO/Extension.pm
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,8 @@ sub object_end_of_create {
# Add default searches to new user's footer
my $dbh = Bugzilla->dbh;

my $sharer = Bugzilla::User->new({name => '[email protected]'}) or return;
my $sharer = Bugzilla::User->new({name => Bugzilla->localconfig->nobody_user})
or return;
my $group = Bugzilla::Group->new({name => 'everyone'}) or return;

foreach my $definition (@default_named_queries) {
Expand Down Expand Up @@ -1012,7 +1013,7 @@ sub _bug_reporters_hw_os {
sub _bug_is_unassigned {
my ($self) = @_;
my $assignee = $self->assigned_to->login;
return $assignee eq '[email protected]' || $assignee =~ /@(?!invalid).+\.bugs$/;
return $assignee eq Bugzilla->localconfig->nobody_user || $assignee =~ /@(?!invalid).+\.bugs$/;
}

sub _bug_has_current_patch {
Expand Down Expand Up @@ -1192,7 +1193,7 @@ sub object_start_of_update {

# and the assignee isn't a real person
return
unless $new_bug->assigned_to->login eq '[email protected]'
unless $new_bug->assigned_to->login eq Bugzilla->localconfig->nobody_user
|| $new_bug->assigned_to->login =~ /@(?!invalid).+\.bugs$/;

# and the user can set the status to NEW
Expand Down Expand Up @@ -1927,7 +1928,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 => '[email protected]'}));
Bugzilla->set_user(Bugzilla::User->new(
{name => Bugzilla->localconfig->nobody_user}));
my $new_user = Bugzilla->user;

# HACK: User needs to be in the editbugs and primary bug's group to allow
Expand Down
2 changes: 1 addition & 1 deletion extensions/BMO/bin/bug_1093952.pl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
print "Press <Ctrl-C> to stop or <Enter> to continue...\n";
getc();

my $nobody = Bugzilla::User->check({name => '[email protected]'});
my $nobody = Bugzilla::User->check({name => Bugzilla->localconfig->nobody_user});
my $field = Bugzilla::Field->check({name => 'status_whiteboard'});
my $when = $dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');

Expand Down
2 changes: 1 addition & 1 deletion extensions/BMO/bin/migrate-github-pull-requests.pl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use Bugzilla::Util qw(trim);

my $dbh = Bugzilla->dbh;
my $nobody = Bugzilla::User->check({name => '[email protected]'});
my $nobody = Bugzilla::User->check({name => Bugzilla->localconfig->nobody_user});
my $field = Bugzilla::Field->check({name => 'attachments.mimetype'});

# grab list of suitable attachments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
[% group.name FILTER html %]</span>
</td>
<td nowrap>
[% IF group.owner.login == '[email protected]' %]
[% IF group.owner.login == Bugzilla.localconfig.nobody_user %]
&ndash;
[% ELSE %]
[% INCLUDE global/user.html.tmpl who = group.owner %]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# these are used in a few places
is_cced = bug.cc.contains(user.login);
unassigned = (bug.assigned_to.login == "[email protected]")
unassigned = (bug.assigned_to.login == Bugzilla.localconfig.nobody_user)
|| (bug.assigned_to.login.search('@(?!invalid).+\.bugs$'));

# custom fields that have custom rendering, or should not be rendered
Expand Down
3 changes: 1 addition & 2 deletions extensions/ComponentWatching/Extension.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use Bugzilla::Util qw(detaint_natural trim);
our $VERSION = '2';

use constant REQUIRE_WATCH_USER => 1;
use constant DEFAULT_ASSIGNEE => '[email protected]';

use constant REL_COMPONENT_WATCHER => 15;

Expand Down Expand Up @@ -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->localconfig->nobody_user;
}

#
Expand Down
2 changes: 1 addition & 1 deletion extensions/PhabBugz/lib/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ sub get_bug_role_phids {
}

sub is_bug_assigned {
return $_[0]->assigned_to->email ne '[email protected]';
return $_[0]->assigned_to->email ne Bugzilla->localconfig->nobody_user;
}

sub is_attachment_phab_revision {
Expand Down
2 changes: 1 addition & 1 deletion extensions/Review/bin/migrate_mentor_from_whiteboard.pl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<>;

# we need to be logged in to do user searching and update bugs
my $nobody = Bugzilla::User->check({name => '[email protected]'});
my $nobody = Bugzilla::User->check({name => Bugzilla->localconfig->nobody_user});
$nobody->{groups} = [Bugzilla::Group->get_all];
Bugzilla->set_user($nobody);

Expand Down
3 changes: 2 additions & 1 deletion extensions/Review/lib/WebService.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 => '[email protected]'}));
Bugzilla->set_user(Bugzilla::User->check(
{name => Bugzilla->localconfig->nobody_user}));
push @reviewers, @{$bug->mentors};
Bugzilla->set_user($user);
}
Expand Down
Empty file modified extensions/SecureMail/bin/tct
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion extensions/TrackingFlags/bin/bug_825946.pl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BEGIN

Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
my $dbh = Bugzilla->dbh;
my $user = Bugzilla::User->check({name => '[email protected]'});
my $user = Bugzilla::User->check({name => Bugzilla->localconfig->nobody_user});

my $tf_vis = $dbh->selectall_arrayref(<<SQL);
SELECT
Expand Down
2 changes: 1 addition & 1 deletion extensions/TrackingFlags/bin/bulk_flag_clear.pl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ BEGIN

# update bugs

my $nobody = Bugzilla::User->check({name => '[email protected]'});
my $nobody = Bugzilla::User->check({name => Bugzilla->localconfig->nobody_user});

# put our nobody user into all groups to avoid permissions issues
$nobody->{groups} = [Bugzilla::Group->get_all];
Expand Down
6 changes: 4 additions & 2 deletions scripts/disable-stale-users.pl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ BEGIN
components
ON components.watch_user = profiles.userid
WHERE
profiles.login_name != '[email protected]'
profiles.login_name != ?
AND components.id IS NULL
AND NOT profiles.login_name LIKE '%.bugs'
AND NOT profiles.login_name LIKE '%.tld'
Expand All @@ -77,14 +77,16 @@ BEGIN
profiles.userid
EOF

my $nobody = Bugzilla->localconfig->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;

Expand Down
2 changes: 1 addition & 1 deletion scripts/eject-users-from-groups.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

my $dbh = Bugzilla->dbh;
my @remove_group_names;
my $nobody_name = '[email protected]';
my $nobody_name = Bugzilla->localconfig->nobody_user;
my $admin_name = '[email protected]';

GetOptions(
Expand Down
6 changes: 3 additions & 3 deletions scripts/generate_bmo_data.pl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

my @users = (
{
login => '[email protected]',
login => Bugzilla->localconfig->nobody_user,
realname => 'Nobody; OK to take it and work on it',
password => '*'
},
Expand Down Expand Up @@ -232,7 +232,7 @@
name => 'General',
description => 'For bugs in Firefox which do not fit into '
. 'other more specific Firefox components',
initialowner => '[email protected]',
initialowner => Bugzilla->localconfig->nobody_user,
initialqaowner => '',
initial_cc => [],
watch_user => '[email protected]'
Expand All @@ -251,7 +251,7 @@
description =>
'This is the component for issues specific to bugzilla.mozilla.org '
. 'that do not belong in other components.',
initialowner => '[email protected]',
initialowner => Bugzilla->localconfig->nobody_user,
initialqaowner => '',
initial_cc => [],
watch_user => '[email protected]'
Expand Down
3 changes: 2 additions & 1 deletion scripts/move_os.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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 => '[email protected]', cache => 1});
my $nobody = Bugzilla::User->check(
{name => Bugzilla->localconfig->nobody_user, cache => 1});

my $bug_count = @$bug_ids;
if ($bug_count == 0) {
Expand Down
8 changes: 5 additions & 3 deletions scripts/movebugs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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->localconfig->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();

Expand Down
2 changes: 1 addition & 1 deletion scripts/nagios_blocker_checker.pl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
assignee => '',
product => '',
component => '',
unassigned => '[email protected]',
unassigned => Bugzilla->localconfig->nobody_user,

# severities
severity => 'major,critical,blocker',
Expand Down
2 changes: 1 addition & 1 deletion scripts/remove_idle_group_members.pl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
$dbh->bz_commit_transaction();

# [email protected] cannot receive email
next if $group->owner->login eq '[email protected]';
next if $group->owner->login eq Bugzilla->localconfig->nobody_user;

_send_email($group, \@users_removed);
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/reset_default_user.pl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sub usage {
}

# We will need these for entering into bugs_activity
my $who = Bugzilla::User->new({name => '[email protected]'});
my $who = Bugzilla::User->new({name => Bugzilla->localconfig->nobody_user});
my $field = Bugzilla::Field->new({name => $field_name});

my $product_id = $dbh->selectrow_array("SELECT id FROM products WHERE name = ?",
Expand Down
2 changes: 0 additions & 2 deletions skins/standard/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -978,8 +978,6 @@ input[type="radio"]:checked {
}

#header {
height: 48px;
position: fixed;
width: 100%;
z-index: 5;
}
Expand Down
4 changes: 2 additions & 2 deletions t/bmo/comments.t
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ my $bug_1 = Bugzilla::Bug->create({
keywords => [],
cc => [],
comment => 'This is a brand new bug',
assigned_to => '[email protected]',
assigned_to => Bugzilla->localconfig->nobody_user,
});
ok($bug_1->id, "got a new bug");

Expand All @@ -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 => '[email protected]',
assigned_to => Bugzilla->localconfig->nobody_user,
});

my $bug_2_id = $bug_2->id;
Expand Down
2 changes: 1 addition & 1 deletion t/sqlite-memory.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use Test::More;
use Test2::Tools::Mock;
use Try::Tiny;
use Capture::Tiny qw(capture_merged);
use Bugzilla::Test::MockParams;

BEGIN {
$ENV{LOCALCONFIG_ENV} = 'BMO';
$ENV{BMO_db_driver} = 'sqlite';
$ENV{BMO_db_name} = ':memory:';
}
use Bugzilla;
use Bugzilla::Test::MockParams;
BEGIN { Bugzilla->extensions }


Expand Down
2 changes: 1 addition & 1 deletion template/en/default/attachment/create.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<td>
<em>If you want to assign this [% terms.bug %] to yourself,
check the box below.</em><br>
[% IF bug.assigned_to.login == "[email protected]" || bug.assigned_to.login.search('@(?!invalid).+\.bugs$') %]
[% IF bug.assigned_to.login == Bugzilla.localconfig.nobody_user || bug.assigned_to.login.search('@(?!invalid).+\.bugs$') %]
[% take_if_patch = 1 %]
[% END %]
<input type="checkbox" id="takebug" name="takebug" value="1" [% IF take_if_patch %] data-take-if-patch="1" [% END %]>
Expand Down
4 changes: 4 additions & 0 deletions template/en/default/setup/strings.txt.pl
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ END
localconfig_canonical_urlbase => <<'END',
The URL that is the canonical initial leading part of all URLs.
This will be the production URL for a dev site, for instance.
END
localconfig_nobody_user => <<'END',
This is the email address of the "nobody" user, which is used as e.g. the
default user that bugs are assigned to.
END
localconfig_use_suexec => <<'END',
Set this to 1 if Bugzilla runs in an Apache SuexecUserGroup environment.
Expand Down

0 comments on commit f130a48

Please sign in to comment.