]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 686786: Decreasing votestoconfirm in editproducts.cgi crashes Bugzilla
authorFrédéric Buclin <LpSolit@gmail.com>
Wed, 28 Sep 2011 23:27:24 +0000 (01:27 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 28 Sep 2011 23:27:24 +0000 (01:27 +0200)
r/a=mkanat

Bugzilla/Object.pm
Bugzilla/Product.pm
extensions/Voting/Extension.pm
extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl
template/en/default/admin/products/groupcontrol/updated.html.tmpl

index 1cad3e829008e52033d82bdacace49292c414d0b..29a6415b9d7c8e382fe76a6b08ad2feabc2b0269 100644 (file)
@@ -441,6 +441,8 @@ sub audit_log {
 
     # During update, it's the actual %changes hash produced by update().
     foreach my $field (keys %$changes) {
+        # Skip private changes.
+        next if $field =~ /^_/;
         my ($from, $to) = @{ $changes->{$field} };
         $sth->execute($user_id, $class, $self->id, $field, $from, $to);
     }
index 85524ac4739ca184776066e8719a1874624c6847..a0079a03358224d893242f318d0b4eeed3f24980 100644 (file)
@@ -223,7 +223,7 @@ sub update {
                                          $new_setting->{group}->name,
                                          Bugzilla->user->id, $timestamp);
                     }
-                    push(@{$changes->{'group_controls'}->{'now_mandatory'}},
+                    push(@{$changes->{'_group_controls'}->{'now_mandatory'}},
                          {name      => $new_setting->{group}->name,
                           bug_count => scalar @$bug_ids});
                 }
@@ -248,7 +248,7 @@ sub update {
                                          $old_setting->{group}->name, '',
                                          Bugzilla->user->id, $timestamp);
                     }
-                    push(@{$changes->{'group_controls'}->{'now_na'}},
+                    push(@{$changes->{'_group_controls'}->{'now_na'}},
                          {name => $old_setting->{group}->name,
                           bug_count => scalar @$bug_ids});
                 }
index 7a93c672e824169385f54e1cf2285ebc2145f515..6a90176ecd06d7cc594c481b9acf585aa62f82ef 100644 (file)
@@ -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.
     # This part doesn't work in the general case because _remove_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
     my $bug_list = $dbh->selectcol_arrayref(
@@ -738,7 +738,7 @@ sub _modify_bug_votes {
         my $confirmed = _confirm_if_vote_confirmed($bug_id);
         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.
     foreach my $msg (@msgs) {
@@ -748,7 +748,7 @@ sub _modify_bug_votes {
     foreach my $bug_id (@updated_bugs) {
         my $sent_bugmail = Bugzilla::BugMail::Send(
             $bug_id, { changer => Bugzilla->user });
-        $changes->{'confirmed_bugs_sent_bugmail'}->{$bug_id} = $sent_bugmail;
+        $changes->{'_confirmed_bugs_sent_bugmail'}->{$bug_id} = $sent_bugmail;
     }
 }
 
index af2b1c10280df92cae91c1d88439d0e611364831..15fb1efe067547c8a3777121794b79032a5bf440 100644 (file)
@@ -56,8 +56,8 @@
 
   <p>Checking existing votes in this product for anybody who now
   has too many votes for [% terms.abug %]...<br>
-  [% IF changes.too_many_votes.size %]
-    [% FOREACH detail = changes.too_many_votes %]
+  [% IF changes._too_many_votes.size %]
+    [% FOREACH detail = changes._too_many_votes %]
       &rarr;removed votes for [% terms.bug %] <a href="show_bug.cgi?id=
      [%- detail.id FILTER uri %]">
      [%- detail.id FILTER html %]</a> from [% detail.name FILTER html %]<br>
@@ -69,8 +69,8 @@
 
   <p>Checking existing votes in this product for anybody
   who now has too many total votes...<br>
-  [% IF changes.too_many_total_votes.size %]
-    [% FOREACH detail = changes.too_many_total_votes %]
+  [% IF changes._too_many_total_votes.size %]
+    [% FOREACH detail = changes._too_many_total_votes %]
       &rarr;removed votes for [% terms.bug %] <a href="show_bug.cgi?id=
      [%- detail.id FILTER uri %]">
      [%- detail.id FILTER html %]</a> from [% detail.name FILTER html %]<br>
 
   <p>Checking unconfirmed [% terms.bugs %] in this product for any which now have
   sufficient votes...<br>
-  [% IF changes.confirmed_bugs.size %]
-    [% FOREACH id = changes.confirmed_bugs %]
+  [% IF changes._confirmed_bugs.size %]
+    [% FOREACH id = changes._confirmed_bugs %]
 
       [%# This is INCLUDED instead of PROCESSED to avoid variables getting
           overwritten, which happens otherwise %]
       [% INCLUDE bug/process/results.html.tmpl
         type = 'votes'
         header_done = 1
-        sent_bugmail = changes.confirmed_bugs_sent_bugmail.$id
+        sent_bugmail = changes._confirmed_bugs_sent_bugmail.$id
         id = id
       %]
     [% END %]
index 2f59cae685e533ece0118439d0441bc8b6413a14..353ce5c755fa0808c7bd153827cf0bad8902bc1b 100644 (file)
   title = title
 %]
 <p>
-[% IF changes.group_controls.now_na.size %]
-  [% FOREACH g = changes.group_controls.now_na %]
+[% IF changes._group_controls.now_na.size %]
+  [% FOREACH g = changes._group_controls.now_na %]
     Removing [% terms.bugs %] from group '[% g.name FILTER html %]' which
     no longer applies to this product<p>
     [% g.bug_count FILTER html %] [%+ terms.bugs %] removed<p>
   [% END %]
 [% END %]
 
-[% IF changes.group_controls.now_mandatory.size %]
-  [% FOREACH g = changes.group_controls.now_mandatory %]
+[% IF changes._group_controls.now_mandatory.size %]
+  [% FOREACH g = changes._group_controls.now_mandatory %]
     Adding [% terms.bugs %] to group '[% g.name FILTER html %]' which is 
     mandatory for this product<p>
     [% g.bug_count FILTER html %] [%+ terms.bugs %] added<p>