summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-06-19 22:27:23 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-06-19 22:27:23 +0200
commitaa11ef5c0603f18fd5fdfdf921d1119f36573434 (patch)
treee16b61dae45b97451c9c759005efc5a2bdb3301a /extensions
parent9c4ff7b0962bf8c77688d0ce183777ecfa474dc2 (diff)
downloadbugzilla-aa11ef5c0603f18fd5fdfdf921d1119f36573434.tar.gz
bugzilla-aa11ef5c0603f18fd5fdfdf921d1119f36573434.tar.xz
Bug 1176368: backport upstream bug 1171813 to bmo/master to fix changing of voting value to auto confirm bugs
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Voting/Extension.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm
index 0ef79d3d3..39ed7c4b4 100644
--- a/extensions/Voting/Extension.pm
+++ b/extensions/Voting/Extension.pm
@@ -639,7 +639,7 @@ sub _update_votes {
$sth_getVotes->execute($id);
my $v = $sth_getVotes->fetchrow_array || 0;
$sth_updateVotes->execute($v, $id);
- $bugs{$id}->{votes} = $v;
+ $bugs{$id}->{votes} = $v if $bugs{$id};
my $confirmed = _confirm_if_vote_confirmed($bugs{$id} || $id);
push (@updated_bugs, $id) if $confirmed;
}
@@ -750,7 +750,7 @@ sub _modify_bug_votes {
my @updated_bugs;
foreach my $bug_id (@$bug_list) {
- my $confirmed = _confirm_if_vote_confirmed($bug_id);
+ my $confirmed = _confirm_if_vote_confirmed($bug_id, $product);
push (@updated_bugs, $bug_id) if $confirmed;
}
$changes->{'_confirmed_bugs'} = \@updated_bugs;
@@ -856,13 +856,14 @@ sub _remove_votes {
# If a user votes for a bug, or the number of votes required to
# confirm a bug has been reduced, check if the bug is now confirmed.
sub _confirm_if_vote_confirmed {
- my $id = shift;
+ my ($id, $product) = @_;
my $bug = ref $id ? $id : new Bugzilla::Bug({ id => $id, cache => 1 });
+ $product ||= $bug->product_obj;
my $ret = 0;
if (!$bug->everconfirmed
- and $bug->product_obj->{votestoconfirm}
- and $bug->votes >= $bug->product_obj->{votestoconfirm})
+ and $product->{votestoconfirm}
+ and $bug->votes >= $product->{votestoconfirm})
{
$bug->add_comment('', { type => CMT_POPULAR_VOTES });