Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Bugzilla/Bug.pm
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,9 @@ sub create {
unless defined $params->{priority};

# BMO - per-product hw/os defaults
if (!defined $params->{rep_platform} || !defined $params->{op_sys}) {
if (Bugzilla::Product->can('default_platform')
&& (!defined $params->{rep_platform} || !defined $params->{op_sys}))
{
if (my $product
= Bugzilla::Product->new({name => $params->{product}, cache => 1}))
{
Expand Down Expand Up @@ -2015,7 +2017,8 @@ sub _check_groups {
my $group = Bugzilla::Group->check_no_disclose({%args, name => $name});

# BMO : allow bugs to be always placed into some groups
if ( !$product->group_always_settable($group)
if ( !($product->can('group_always_settable')
&& $product->group_always_settable($group))
&& !$product->group_is_settable($group))
{
ThrowUserError('group_restriction_not_allowed', {%args, name => $name});
Expand Down Expand Up @@ -3292,7 +3295,8 @@ sub add_group {
# BMO : allow bugs to be always placed into some groups by the bug's
# reporter, or by users with editbugs
my $user = Bugzilla->user;
if (!$self->product_obj->group_always_settable($group)
if (!($self->product_obj->can('group_always_settable')
&& $self->product_obj->group_always_settable($group))
|| ($self->{reporter_id} != $user->id && !$user->in_group('editbugs')))
{
# Make sure that bugs in this product can actually be restricted
Expand Down
20 changes: 10 additions & 10 deletions Bugzilla/Test/MockDB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,16 @@ sub import {
$class_id
= Bugzilla::Classification->new({name => $product->{classification}})->id;
}
$dbh->do(
'INSERT INTO products (name, description, classification_id,
default_op_sys_id, default_platform_id)
VALUES (?, ?, ?, ?, ?)',
undef,
(
$product->{product_name}, $product->{description}, $class_id,
$default_op_sys_id, $default_platform_id
)
);
my @cols = qw(name description classification_id);
my @vals
= ($product->{product_name}, $product->{description}, $class_id);
if ($dbh->bz_column_info('products', 'default_op_sys_id')) {
push @cols, qw(default_op_sys_id default_platform_id);
push @vals, $default_op_sys_id, $default_platform_id;
}
$dbh->do('INSERT INTO products (' . join(', ', @cols)
. ') VALUES (' . join(', ', ('?') x @cols) . ')',
undef, @vals);

$new_product = new Bugzilla::Product({name => $product->{product_name}});

Expand Down
15 changes: 10 additions & 5 deletions Bugzilla/WebService/Product.pm
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,18 @@ sub _product_to_hash {
}

# BMO - add default hw/os
$field_data->{default_platform}
= $self->type('string', $product->default_platform);
$field_data->{default_op_sys} = $self->type('string', $product->default_op_sys);
if ($product->can('default_platform')) {
$field_data->{default_platform}
= $self->type('string', $product->default_platform);
$field_data->{default_op_sys}
= $self->type('string', $product->default_op_sys);
}

# BMO - add default security group
$field_data->{default_security_group}
= $self->type('string', $product->default_security_group);
if ($product->can('default_security_group')) {
$field_data->{default_security_group}
= $self->type('string', $product->default_security_group);
}
return filter($params, $field_data);
}

Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/WebService/User.pm
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ sub _user_from_phab_token {
# `user.whoami` endpoint.

# only if PhabBugz is configure and X-PHABRICATOR-TOKEN is provided
(my $phab_url = Bugzilla->params->{phabricator_base_uri}) =~ s{/$}{};
(my $phab_url = Bugzilla->params->{phabricator_base_uri} // '') =~ s{/$}{};
my $phab_token = Bugzilla->input_params->{Phabricator_token};
return undef unless $phab_url && $phab_token;

Expand Down
4 changes: 2 additions & 2 deletions enter_bug.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ else {

# BMO - use per-product default hw/os
$default{'rep_platform'}
= formvalue('rep_platform', $product->default_platform // detect_platform());
= formvalue('rep_platform', ($product->can('default_platform') ? $product->default_platform : undef) // detect_platform());
$default{'op_sys'}
= formvalue('op_sys', $product->default_op_sys // detect_op_sys());
= formvalue('op_sys', ($product->can('default_op_sys') ? $product->default_op_sys : undef) // detect_op_sys());
$vars->{'rep_platform'} = detect_platform();
$vars->{'rep_op_sys'} = detect_op_sys();

Expand Down
Empty file added extensions/BMO/disabled
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@
product.
</div>
</div>

<div id="guided">
<a id="guided_img" href="[% basepath FILTER none %]enter_bug.cgi?format=guided&amp;product=[% product.name FILTER uri %]">
<img src="[% basepath FILTER none %]extensions/BMO/web/images/guided.png" width="16" height="16" alt="">
Switch to the [% terms.Bugzilla %] Helper
</a>
| <a href="[% basepath FILTER none %]page.cgi?id=custom_forms.html">Custom [% terms.bug %] entry forms</a>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
[% title = "Missing Username" %]
You must provide at least one email address to report on.

[% ELSIF error == "report_invalid_date" %]
[% title = "Invalid Date" %]
The date '[% date FILTER html %]' is invalid.

[% ELSIF error == "report_invalid_parameter" %]
[% title = "Invalid Parameter" %]
The value for parameter [% name FILTER html %] is invalid.
Expand Down
11 changes: 9 additions & 2 deletions extensions/BugModal/lib/WebService.pm
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,15 @@ sub new_product {
}
}

my $default_group_name = $product->default_security_group;
if (my $default_group
my $default_group_name
= $product->can('default_security_group')
? $product->default_security_group
: undef;
if (!defined $default_group_name) {

# no per-product default security group without the BMO extension
}
elsif (my $default_group
= first_value { $_->{group}->name eq $default_group_name } @groups)
{
# because we always allow the default product group to be selected, it's never invalid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
</div>

<div class="groups edit-show" style="display:none">
[% UNLESS bug.in_group(bug.product_obj.default_security_group_obj)
[% UNLESS !bug.product_obj.default_security_group
|| bug.in_group(bug.product_obj.default_security_group_obj)
|| user.in_group(bug.product_obj.default_security_group)
|| (user.id != bug.reporter.id && !user.in_group('editbugs')) %]
<div>
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added extensions/PhabBugz/disabled
Empty file.
1 change: 1 addition & 0 deletions extensions/Profanivore/Extension.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use base qw(Bugzilla::Extension);

use Email::MIME::ContentType qw(parse_content_type);
use Regexp::Common 'RE_ALL';
use HTML::Tree;

use Bugzilla::Util qw(is_7bit_clean);

Expand Down
Empty file added extensions/REMO/disabled
Empty file.
Empty file added extensions/ZPushNotify/disabled
Empty file.
15 changes: 7 additions & 8 deletions qa/config/generate_test_data.pl
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,20 @@ BEGIN
# BMO uses P1-P5 which is different from upstream
my $field = Bugzilla::Field->new({name => 'priority'});
foreach my $value (qw(Highest High Normal Low Lowest)) {
next if Bugzilla::Field::Choice->type($field)->new({name => $value});
Bugzilla::Field::Choice->type($field)->create({value => $value, sortkey => 0});
}

# Add missing platforms
$field = Bugzilla::Field->new({name => 'rep_platform'});
foreach my $value (qw(PC)) {
next if Bugzilla::Field::Choice->type($field)->new({name => $value});
Bugzilla::Field::Choice->type($field)->create({value => $value, sortkey => 0});
}

my %set_params = (
usebugaliases => 1,
useclassification => 1,
useqacontact => 1,
mail_delivery_method => 'Test',
maxattachmentsize => 256,
Expand Down Expand Up @@ -520,14 +523,10 @@ BEGIN
= Bugzilla::Classification->new({name => $product->{classification}})->id;
}
$dbh->do(
'INSERT INTO products (name, description, classification_id, default_platform_id, default_op_sys_id)
VALUES (?, ?, ?, ?, ?)',
'INSERT INTO products (name, description, classification_id)
VALUES (?, ?, ?)',
undef,
(
$product->{product_name}, $product->{description},
$class_id, $new_product->{default_platform_id},
$new_product->{default_op_sys_id}
)
($product->{product_name}, $product->{description}, $class_id)
);

$new_product = new Bugzilla::Product({name => $product->{product_name}});
Expand Down Expand Up @@ -629,7 +628,7 @@ BEGIN
my $default_security_group
= Bugzilla::Group->new({name => 'core-security-release'});
$default_security_group ||= Bugzilla::Group->new({name => 'Master'});
if ($default_security_group) {
if ($default_security_group && $dbh->bz_column_info('products', 'security_group_id')) {
$dbh->do(
'UPDATE products SET security_group_id = ? WHERE security_group_id IS NULL',
undef, $default_security_group->id);
Expand Down
5 changes: 4 additions & 1 deletion qa/t/test_bmo_autolinkification.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ use strict;
use warnings;
use lib qw(lib ../../lib ../../local/lib/perl5);

use Test::More "no_plan";
use Test::More;
plan -e '../../extensions/BMO/disabled'
? (skip_all => 'BMO extension is disabled')
: 'no_plan';

use QA::Util;

Expand Down
5 changes: 4 additions & 1 deletion qa/t/test_bmo_enter_new_bug.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ use strict;
use warnings;
use lib qw(lib ../../lib ../../local/lib/perl5);

use Test::More "no_plan";
use Test::More;
plan -e '../../extensions/BMO/disabled'
? (skip_all => 'BMO extension is disabled')
: 'no_plan';

use QA::Util;

Expand Down
24 changes: 15 additions & 9 deletions qa/t/test_default_groups.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ set_parameters($sel, {"Group Security" => {"makeproductgroups-on" => undef}});
add_product($sel);
$sel->type_ok("product", "ready_to_die");
$sel->type_ok("description", "will die");
$sel->select_ok("security_group_id", "label=core-security");
$sel->select_ok("default_op_sys_id", "label=Unspecified");
$sel->select_ok("default_platform_id", "label=Unspecified");
if ($sel->is_element_present("security_group_id")) {
$sel->select_ok("security_group_id", "label=core-security");
$sel->select_ok("default_op_sys_id", "label=Unspecified");
$sel->select_ok("default_platform_id", "label=Unspecified");
}
$sel->click_ok('//input[@value="Add"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Product Created");
Expand Down Expand Up @@ -84,9 +86,11 @@ $sel->is_text_present_ok("Access to bugs in the ready_to_die product");
add_product($sel);
$sel->type_ok("product", "ready_to_die");
$sel->type_ok("description", "will die");
$sel->select_ok("security_group_id", "label=core-security");
$sel->select_ok("default_op_sys_id", "label=Unspecified");
$sel->select_ok("default_platform_id", "label=Unspecified");
if ($sel->is_element_present("security_group_id")) {
$sel->select_ok("security_group_id", "label=core-security");
$sel->select_ok("default_op_sys_id", "label=Unspecified");
$sel->select_ok("default_platform_id", "label=Unspecified");
}
$sel->click_ok('//input[@value="Add"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Product Created");
Expand Down Expand Up @@ -174,9 +178,11 @@ set_parameters($sel, {"Group Security" => {"makeproductgroups-off" => undef}});
add_product($sel);
$sel->type_ok("product", "ready_to_die");
$sel->type_ok("description", "will die");
$sel->select_ok("security_group_id", "label=core-security");
$sel->select_ok("default_op_sys_id", "label=Unspecified");
$sel->select_ok("default_platform_id", "label=Unspecified");
if ($sel->is_element_present("security_group_id")) {
$sel->select_ok("security_group_id", "label=core-security");
$sel->select_ok("default_op_sys_id", "label=Unspecified");
$sel->select_ok("default_platform_id", "label=Unspecified");
}
$sel->click_ok('//input[@value="Add"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Product Created");
Expand Down
8 changes: 5 additions & 3 deletions qa/t/test_edit_products_properties.t
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ if ($config->{test_extensions}) {
$sel->type_ok("votestoconfirm", "10");
}
$sel->type_ok("version", "0.1a");
$sel->select_ok("security_group_id", "label=core-security");
$sel->select_ok("default_op_sys_id", "label=Unspecified");
$sel->select_ok("default_platform_id", "label=Unspecified");
if ($sel->is_element_present("security_group_id")) {
$sel->select_ok("security_group_id", "label=core-security");
$sel->select_ok("default_op_sys_id", "label=Unspecified");
$sel->select_ok("default_platform_id", "label=Unspecified");
}
$sel->click_ok('//input[@type="submit" and @value="Add"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$text = trim($sel->get_text("message"));
Expand Down
8 changes: 5 additions & 3 deletions qa/t/test_votes.t
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ $sel->type_ok("description", "A great new product");
$sel->type_ok("votesperuser", 10);
$sel->type_ok("maxvotesperbug", 5);
$sel->type_ok("votestoconfirm", 3);
$sel->select_ok("security_group_id", "label=core-security");
$sel->select_ok("default_op_sys_id", "label=Unspecified");
$sel->select_ok("default_platform_id", "label=Unspecified");
if ($sel->is_element_present("security_group_id")) {
$sel->select_ok("security_group_id", "label=core-security");
$sel->select_ok("default_op_sys_id", "label=Unspecified");
$sel->select_ok("default_platform_id", "label=Unspecified");
}
$sel->click_ok('//input[@type="submit" and @value="Add"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Product Created");
Expand Down
6 changes: 5 additions & 1 deletion scripts/entrypoint.pl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ sub cmd_load_test_data {
run(
'perl', 'scripts/generate_bmo_data.pl',
'--param', 'use_mailer_queue=0'
);
) unless -f q(/app/extensions/BMO/disabled);

if ($ENV{BZ_QA_CONFIG}) {
chdir '/app/qa/config';
Expand All @@ -188,6 +188,10 @@ sub cmd_push_data {

sub cmd_test_sanity {
my @tests = @_;

# Skip tests of extensions that are disabled
@tests = grep { not (m#^(?:\./)?extensions/([^/]+)/# and -e "/app/extensions/$1/disabled") } @tests;

run('prove', '-I/app', '-I/app/local/lib/perl5', '-qf', @tests);
}

Expand Down
5 changes: 5 additions & 0 deletions t/bmo/comments.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ use warnings;
use lib qw(. lib local/lib/perl5);
use Test::More;

BEGIN {
plan skip_all => 'BMO extension is disabled'
if -e 'extensions/BMO/disabled';
}

use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Bug;
Expand Down
8 changes: 4 additions & 4 deletions t/mock-params.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use lib qw( . lib local/lib/perl5 );
use Test::More;
use Test2::Tools::Mock qw(mock);
use Bugzilla::Test::MockParams (
phabricator_auth_callback_url => 'http://pants.gov/',);
announcehtml => 'http://pants.gov/',);

is(Bugzilla->params->{phabricator_auth_callback_url},
is(Bugzilla->params->{announcehtml},
'http://pants.gov/', 'import default params');

Bugzilla::Test::MockParams->import(phabricator_api_key => 'FAKE-KEY');
Bugzilla::Test::MockParams->import(mailfrom => 'FAKE-KEY');

is(Bugzilla->params->{phabricator_api_key}, 'FAKE-KEY', 'set key');
is(Bugzilla->params->{mailfrom}, 'FAKE-KEY', 'set key');


done_testing;
8 changes: 0 additions & 8 deletions template/en/default/bug/create/create.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -831,14 +831,6 @@ TUI_hide_default('expert_fields');
[%# Links or content with more information about the bug being created. %]
[% Hook.process("end") %]

<div id="guided">
<a id="guided_img" href="[% basepath FILTER none %]enter_bug.cgi?format=guided&amp;product=[% product.name FILTER uri %]">
<img src="[% basepath FILTER none %]extensions/BMO/web/images/guided.png" width="16" height="16" alt="">
Switch to the [% terms.Bugzilla %] Helper
</a>
| <a href="[% basepath FILTER none %]page.cgi?id=custom_forms.html">Custom [% terms.bug %] entry forms</a>
</div>

[% PROCESS global/footer.html.tmpl %]

[%############################################################################%]
Expand Down
4 changes: 4 additions & 0 deletions template/en/default/global/user-error.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,10 @@
for [% terms.bug %] [%+ bug_id FILTER html %]
has a circular dependency on [% terms.bug %] [%+ dep_id FILTER html %].

[% ELSIF error == "report_invalid_date" %]
[% title = "Invalid Date" %]
The date '[% date FILTER html %]' is invalid.

[% ELSIF error == "request_queue_group_invalid" %]
The group field <em>[% group FILTER html %]</em> is invalid.

Expand Down
Loading