summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-04-21 08:00:18 +0200
committerByron Jones <glob@mozilla.com>2015-04-21 08:00:18 +0200
commit5db6eeb9cf4bf82d785dd193703b46b2139247e5 (patch)
tree2cd234261c4cc56e4035b035b0fc20990ec9a6f6 /Bugzilla
parent4aa44c46edf93a9707fc693769f39e5aeda7f59b (diff)
downloadbugzilla-5db6eeb9cf4bf82d785dd193703b46b2139247e5.tar.gz
bugzilla-5db6eeb9cf4bf82d785dd193703b46b2139247e5.tar.xz
Bug 579089: Change default Hardware / OS values to be "Unspecified/Unspecified"
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm13
-rw-r--r--Bugzilla/UserAgent.pm4
-rw-r--r--Bugzilla/WebService/Product.pm3
3 files changed, 14 insertions, 6 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index e1f533274..6dbcffe34 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -702,10 +702,15 @@ sub create {
unless defined $params->{bug_severity};
$params->{priority} = Bugzilla->params->{defaultpriority}
unless defined $params->{priority};
- $params->{op_sys} = Bugzilla->params->{defaultopsys}
- unless defined $params->{op_sys};
- $params->{rep_platform} = Bugzilla->params->{defaultplatform}
- unless defined $params->{rep_platform};
+
+ # BMO - per-product hw/os defaults
+ if (!defined $params->{rep_platform} || !defined $params->{op_sys}) {
+ if (my $product = Bugzilla::Product->new({ name => $params->{product}, cache => 1 })) {
+ $params->{rep_platform} //= $product->default_product;
+ $params->{op_sys} //= $product->default_op_sys;
+ }
+ }
+
# Make sure a comment is always defined.
$params->{comment} = '' unless defined $params->{comment};
diff --git a/Bugzilla/UserAgent.pm b/Bugzilla/UserAgent.pm
index 62d6115a9..9c8686f0c 100644
--- a/Bugzilla/UserAgent.pm
+++ b/Bugzilla/UserAgent.pm
@@ -183,7 +183,7 @@ use constant OS_MAP => (
);
sub detect_platform {
- my $userAgent = $ENV{'HTTP_USER_AGENT'} || '';
+ my $userAgent = shift || Bugzilla->cgi->user_agent || '';
my @detected;
my $iterator = natatime(2, PLATFORMS_MAP);
while (my($re, $ra) = $iterator->()) {
@@ -195,7 +195,7 @@ sub detect_platform {
}
sub detect_op_sys {
- my $userAgent = $ENV{'HTTP_USER_AGENT'} || '';
+ my $userAgent = shift || Bugzilla->cgi->user_agent || '';
my @detected;
my $iterator = natatime(2, OS_MAP);
while (my($re, $ra) = $iterator->()) {
diff --git a/Bugzilla/WebService/Product.pm b/Bugzilla/WebService/Product.pm
index be082c778..b7484327f 100644
--- a/Bugzilla/WebService/Product.pm
+++ b/Bugzilla/WebService/Product.pm
@@ -202,6 +202,9 @@ sub _product_to_hash {
$self->_milestone_to_hash($_, $params)
} @{$product->milestones}];
}
+ # 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);
return filter($params, $field_data);
}