Commit dd832b27 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 686786: Decreasing votestoconfirm in editproducts.cgi crashes Bugzilla

r/a=mkanat
parent 36478e4e
...@@ -441,6 +441,8 @@ sub audit_log { ...@@ -441,6 +441,8 @@ sub audit_log {
# During update, it's the actual %changes hash produced by update(). # During update, it's the actual %changes hash produced by update().
foreach my $field (keys %$changes) { foreach my $field (keys %$changes) {
# Skip private changes.
next if $field =~ /^_/;
my ($from, $to) = @{ $changes->{$field} }; my ($from, $to) = @{ $changes->{$field} };
$sth->execute($user_id, $class, $self->id, $field, $from, $to); $sth->execute($user_id, $class, $self->id, $field, $from, $to);
} }
......
...@@ -223,7 +223,7 @@ sub update { ...@@ -223,7 +223,7 @@ sub update {
$new_setting->{group}->name, $new_setting->{group}->name,
Bugzilla->user->id, $timestamp); Bugzilla->user->id, $timestamp);
} }
push(@{$changes->{'group_controls'}->{'now_mandatory'}}, push(@{$changes->{'_group_controls'}->{'now_mandatory'}},
{name => $new_setting->{group}->name, {name => $new_setting->{group}->name,
bug_count => scalar @$bug_ids}); bug_count => scalar @$bug_ids});
} }
...@@ -248,7 +248,7 @@ sub update { ...@@ -248,7 +248,7 @@ sub update {
$old_setting->{group}->name, '', $old_setting->{group}->name, '',
Bugzilla->user->id, $timestamp); Bugzilla->user->id, $timestamp);
} }
push(@{$changes->{'group_controls'}->{'now_na'}}, push(@{$changes->{'_group_controls'}->{'now_na'}},
{name => $old_setting->{group}->name, {name => $old_setting->{group}->name,
bug_count => scalar @$bug_ids}); bug_count => scalar @$bug_ids});
} }
......
...@@ -678,7 +678,7 @@ sub _modify_bug_votes { ...@@ -678,7 +678,7 @@ sub _modify_bug_votes {
} }
} }
$changes->{'too_many_votes'} = \@toomanyvotes_list; $changes->{'_too_many_votes'} = \@toomanyvotes_list;
# 2. too many total votes for a single user. # 2. too many total votes for a single user.
# This part doesn't work in the general case because _remove_votes # This part doesn't work in the general case because _remove_votes
...@@ -725,7 +725,7 @@ sub _modify_bug_votes { ...@@ -725,7 +725,7 @@ sub _modify_bug_votes {
} }
} }
$changes->{'too_many_total_votes'} = \@toomanytotalvotes_list; $changes->{'_too_many_total_votes'} = \@toomanytotalvotes_list;
# 3. enough votes to confirm # 3. enough votes to confirm
my $bug_list = $dbh->selectcol_arrayref( my $bug_list = $dbh->selectcol_arrayref(
...@@ -738,7 +738,7 @@ sub _modify_bug_votes { ...@@ -738,7 +738,7 @@ sub _modify_bug_votes {
my $confirmed = _confirm_if_vote_confirmed($bug_id); my $confirmed = _confirm_if_vote_confirmed($bug_id);
push (@updated_bugs, $bug_id) if $confirmed; push (@updated_bugs, $bug_id) if $confirmed;
} }
$changes->{'confirmed_bugs'} = \@updated_bugs; $changes->{'_confirmed_bugs'} = \@updated_bugs;
# Now that changes are done, we can send emails to voters. # Now that changes are done, we can send emails to voters.
foreach my $msg (@msgs) { foreach my $msg (@msgs) {
...@@ -748,7 +748,7 @@ sub _modify_bug_votes { ...@@ -748,7 +748,7 @@ sub _modify_bug_votes {
foreach my $bug_id (@updated_bugs) { foreach my $bug_id (@updated_bugs) {
my $sent_bugmail = Bugzilla::BugMail::Send( my $sent_bugmail = Bugzilla::BugMail::Send(
$bug_id, { changer => Bugzilla->user }); $bug_id, { changer => Bugzilla->user });
$changes->{'confirmed_bugs_sent_bugmail'}->{$bug_id} = $sent_bugmail; $changes->{'_confirmed_bugs_sent_bugmail'}->{$bug_id} = $sent_bugmail;
} }
} }
......
...@@ -56,8 +56,8 @@ ...@@ -56,8 +56,8 @@
<p>Checking existing votes in this product for anybody who now <p>Checking existing votes in this product for anybody who now
has too many votes for [% terms.abug %]...<br> has too many votes for [% terms.abug %]...<br>
[% IF changes.too_many_votes.size %] [% IF changes._too_many_votes.size %]
[% FOREACH detail = changes.too_many_votes %] [% FOREACH detail = changes._too_many_votes %]
&rarr;removed votes for [% terms.bug %] <a href="show_bug.cgi?id= &rarr;removed votes for [% terms.bug %] <a href="show_bug.cgi?id=
[%- detail.id FILTER uri %]"> [%- detail.id FILTER uri %]">
[%- detail.id FILTER html %]</a> from [% detail.name FILTER html %]<br> [%- detail.id FILTER html %]</a> from [% detail.name FILTER html %]<br>
...@@ -69,8 +69,8 @@ ...@@ -69,8 +69,8 @@
<p>Checking existing votes in this product for anybody <p>Checking existing votes in this product for anybody
who now has too many total votes...<br> who now has too many total votes...<br>
[% IF changes.too_many_total_votes.size %] [% IF changes._too_many_total_votes.size %]
[% FOREACH detail = changes.too_many_total_votes %] [% FOREACH detail = changes._too_many_total_votes %]
&rarr;removed votes for [% terms.bug %] <a href="show_bug.cgi?id= &rarr;removed votes for [% terms.bug %] <a href="show_bug.cgi?id=
[%- detail.id FILTER uri %]"> [%- detail.id FILTER uri %]">
[%- detail.id FILTER html %]</a> from [% detail.name FILTER html %]<br> [%- detail.id FILTER html %]</a> from [% detail.name FILTER html %]<br>
...@@ -82,15 +82,15 @@ ...@@ -82,15 +82,15 @@
<p>Checking unconfirmed [% terms.bugs %] in this product for any which now have <p>Checking unconfirmed [% terms.bugs %] in this product for any which now have
sufficient votes...<br> sufficient votes...<br>
[% IF changes.confirmed_bugs.size %] [% IF changes._confirmed_bugs.size %]
[% FOREACH id = changes.confirmed_bugs %] [% FOREACH id = changes._confirmed_bugs %]
[%# This is INCLUDED instead of PROCESSED to avoid variables getting [%# This is INCLUDED instead of PROCESSED to avoid variables getting
overwritten, which happens otherwise %] overwritten, which happens otherwise %]
[% INCLUDE bug/process/results.html.tmpl [% INCLUDE bug/process/results.html.tmpl
type = 'votes' type = 'votes'
header_done = 1 header_done = 1
sent_bugmail = changes.confirmed_bugs_sent_bugmail.$id sent_bugmail = changes._confirmed_bugs_sent_bugmail.$id
id = id id = id
%] %]
[% END %] [% END %]
......
...@@ -27,16 +27,16 @@ ...@@ -27,16 +27,16 @@
title = title title = title
%] %]
<p> <p>
[% IF changes.group_controls.now_na.size %] [% IF changes._group_controls.now_na.size %]
[% FOREACH g = changes.group_controls.now_na %] [% FOREACH g = changes._group_controls.now_na %]
Removing [% terms.bugs %] from group '[% g.name FILTER html %]' which Removing [% terms.bugs %] from group '[% g.name FILTER html %]' which
no longer applies to this product<p> no longer applies to this product<p>
[% g.bug_count FILTER html %] [%+ terms.bugs %] removed<p> [% g.bug_count FILTER html %] [%+ terms.bugs %] removed<p>
[% END %] [% END %]
[% END %] [% END %]
[% IF changes.group_controls.now_mandatory.size %] [% IF changes._group_controls.now_mandatory.size %]
[% FOREACH g = changes.group_controls.now_mandatory %] [% FOREACH g = changes._group_controls.now_mandatory %]
Adding [% terms.bugs %] to group '[% g.name FILTER html %]' which is Adding [% terms.bugs %] to group '[% g.name FILTER html %]' which is
mandatory for this product<p> mandatory for this product<p>
[% g.bug_count FILTER html %] [%+ terms.bugs %] added<p> [% g.bug_count FILTER html %] [%+ terms.bugs %] added<p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment