зеркало из https://github.com/mozilla/gecko-dev.git
Bug 222564 - The chart made when creating a new Product/Component is not public. Patch by gerv; r=kiko, a=justdave.
This commit is contained in:
Родитель
02ed558f55
Коммит
7d65372c95
|
@ -39,17 +39,22 @@ sub new {
|
||||||
|
|
||||||
if ($#_ == 0) {
|
if ($#_ == 0) {
|
||||||
if (ref($_[0])) {
|
if (ref($_[0])) {
|
||||||
# We've been given a CGI object
|
# We've been given a CGI object to create a new Series from.
|
||||||
$self->readParametersFromCGI($_[0]);
|
$self->readParametersFromCGI($_[0]);
|
||||||
$self->createInDatabase();
|
$self->createInDatabase();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# We've been given a series_id.
|
# We've been given a series_id, which should represent an existing
|
||||||
|
# Series.
|
||||||
$self->initFromDatabase($_[0]);
|
$self->initFromDatabase($_[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ($#_ >= 3) {
|
elsif ($#_ == 6) {
|
||||||
$self->initFromParameters(@_);
|
# We've been given a load of parameters to create a new Series from.
|
||||||
|
# We don't get given a series_id; we generate that for ourselves
|
||||||
|
# when we call createInDatabase(). So we pass -1 here.
|
||||||
|
$self->initFromParameters(-1, @_);
|
||||||
|
$self->createInDatabase();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
die("Bad parameters passed in - invalid number of args \($#_\)($_)");
|
die("Bad parameters passed in - invalid number of args \($#_\)($_)");
|
||||||
|
@ -77,7 +82,11 @@ sub initFromDatabase {
|
||||||
"WHERE series.series_id = $series_id");
|
"WHERE series.series_id = $series_id");
|
||||||
|
|
||||||
if (@series) {
|
if (@series) {
|
||||||
|
# Note that we calculate $self->{'public'} ourselves instead of passing
|
||||||
|
# it as the last parameter in @series; this is because isSubscribed()
|
||||||
|
# requires the rest of the object to be set up correctly.
|
||||||
$self->initFromParameters(@series);
|
$self->initFromParameters(@series);
|
||||||
|
$self->{'public'} = $self->isSubscribed(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
&::ThrowCodeError("invalid_series_id", { 'series_id' => $series_id });
|
&::ThrowCodeError("invalid_series_id", { 'series_id' => $series_id });
|
||||||
|
@ -87,14 +96,9 @@ sub initFromDatabase {
|
||||||
sub initFromParameters {
|
sub initFromParameters {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
# The first four parameters are compulsory, unless you immediately call
|
|
||||||
# createInDatabase(), in which case series_id can be left off.
|
|
||||||
($self->{'series_id'}, $self->{'category'}, $self->{'subcategory'},
|
($self->{'series_id'}, $self->{'category'}, $self->{'subcategory'},
|
||||||
$self->{'name'}, $self->{'creator'}, $self->{'frequency'},
|
$self->{'name'}, $self->{'creator'}, $self->{'frequency'},
|
||||||
$self->{'query'}) = @_;
|
$self->{'query'}, $self->{'public'}) = @_;
|
||||||
|
|
||||||
$self->{'public'} = $self->isSubscribed(0);
|
|
||||||
$self->{'subscribed'} = $self->isSubscribed($::userid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub createInDatabase {
|
sub createInDatabase {
|
||||||
|
|
|
@ -3713,10 +3713,9 @@ if (!$series_exists) {
|
||||||
|
|
||||||
foreach my $field (@fields) {
|
foreach my $field (@fields) {
|
||||||
# Create a Series for each field in this product
|
# Create a Series for each field in this product
|
||||||
my $series = new Bugzilla::Series(-1, $product, $all_name,
|
my $series = new Bugzilla::Series($product, $all_name,
|
||||||
$field, $::userid, 1,
|
$field, $::userid, 1,
|
||||||
$queries{$field});
|
$queries{$field}, 1);
|
||||||
$series->createInDatabase();
|
|
||||||
$seriesids{$field} = $series->{'series_id'};
|
$seriesids{$field} = $series->{'series_id'};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3724,10 +3723,9 @@ if (!$series_exists) {
|
||||||
# the same set as new products (see editproducts.cgi.)
|
# the same set as new products (see editproducts.cgi.)
|
||||||
my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED");
|
my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED");
|
||||||
my $query = join("&", map { "bug_status=$_" } @openedstatuses);
|
my $query = join("&", map { "bug_status=$_" } @openedstatuses);
|
||||||
my $series = new Bugzilla::Series(-1, $product, $all_name,
|
my $series = new Bugzilla::Series($product, $all_name,
|
||||||
$open_name, $::userid, 1,
|
$open_name, $::userid, 1,
|
||||||
$query_prod . $query);
|
$query_prod . $query, 1);
|
||||||
$series->createInDatabase();
|
|
||||||
|
|
||||||
# Now, we attempt to read in historical data, if any
|
# Now, we attempt to read in historical data, if any
|
||||||
# Convert the name in the same way that collectstats.pl does
|
# Convert the name in the same way that collectstats.pl does
|
||||||
|
|
|
@ -465,13 +465,9 @@ if ($action eq 'new') {
|
||||||
push(@series, [$::FORM{'closed_name'}, $resolved . $prodcomp]);
|
push(@series, [$::FORM{'closed_name'}, $resolved . $prodcomp]);
|
||||||
|
|
||||||
foreach my $sdata (@series) {
|
foreach my $sdata (@series) {
|
||||||
# We create the series with an nonsensical series_id, which is
|
my $series = new Bugzilla::Series($product, $component,
|
||||||
# guaranteed not to exist. This is OK, because we immediately call
|
|
||||||
# createInDatabase().
|
|
||||||
my $series = new Bugzilla::Series(-1, $product, $component,
|
|
||||||
$sdata->[0], $::userid, 1,
|
$sdata->[0], $::userid, 1,
|
||||||
$sdata->[1]);
|
$sdata->[1], 1);
|
||||||
$series->createInDatabase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make versioncache flush
|
# Make versioncache flush
|
||||||
|
|
|
@ -426,14 +426,9 @@ if ($action eq 'new') {
|
||||||
push(@series, [$::FORM{'open_name'}, $query]);
|
push(@series, [$::FORM{'open_name'}, $query]);
|
||||||
|
|
||||||
foreach my $sdata (@series) {
|
foreach my $sdata (@series) {
|
||||||
# We create the series with an nonsensical series_id, which is
|
my $series = new Bugzilla::Series($product, $::FORM{'subcategory'},
|
||||||
# guaranteed not to exist. This is OK, because we immediately call
|
|
||||||
# createInDatabase().
|
|
||||||
my $series = new Bugzilla::Series(-1, $product,
|
|
||||||
$::FORM{'subcategory'},
|
|
||||||
$sdata->[0], $::userid, 1,
|
$sdata->[0], $::userid, 1,
|
||||||
$sdata->[1] . "&product=$product");
|
$sdata->[1] . "&product=$product", 1);
|
||||||
$series->createInDatabase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make versioncache flush
|
# Make versioncache flush
|
||||||
|
|
|
@ -123,7 +123,7 @@ function subcatSelected() {
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
[% IF series.creator != 0 %]
|
[% IF series.creator != 0 %]
|
||||||
[% IF series.subscribed %]
|
[% IF series.isSubscribed(user.id) %]
|
||||||
<input type="submit" value="Unsubscribe" style="width: 12ex;"
|
<input type="submit" value="Unsubscribe" style="width: 12ex;"
|
||||||
name="action-unsubscribe[% series.series_id %]">
|
name="action-unsubscribe[% series.series_id %]">
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
|
@ -134,7 +134,7 @@ function subcatSelected() {
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
[% IF user.userid == series.creator OR UserInGroup("admin") %]
|
[% IF user.id == series.creator OR UserInGroup("admin") %]
|
||||||
<a href="chart.cgi?action=edit&series_id=
|
<a href="chart.cgi?action=edit&series_id=
|
||||||
[% series.series_id %]">Edit</a>
|
[% series.series_id %]">Edit</a>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче