summaryrefslogtreecommitdiffstats
path: root/extensions/Voting
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/Voting')
-rw-r--r--extensions/Voting/Extension.pm38
-rw-r--r--extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl14
-rw-r--r--extensions/Voting/template/en/default/hook/bug/edit-after_importance.html.tmpl3
-rw-r--r--extensions/Voting/template/en/default/pages/voting/user.html.tmpl11
4 files changed, 30 insertions, 36 deletions
diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm
index 6a90176ec..44344d7f5 100644
--- a/extensions/Voting/Extension.pm
+++ b/extensions/Voting/Extension.pm
@@ -48,24 +48,13 @@ use constant DEFAULT_VOTES_PER_BUG => 1;
use constant CMT_POPULAR_VOTES => 3;
use constant REL_VOTER => 4;
-################
-# Installation #
-################
-
BEGIN {
- *Bugzilla::Bug::votes = \&votes;
+ *Bugzilla::Bug::user_votes = \&_bug_user_votes;
}
-sub votes {
- my $self = shift;
- my $dbh = Bugzilla->dbh;
-
- return $self->{votes} if exists $self->{votes};
-
- $self->{votes} = $dbh->selectrow_array('SELECT votes FROM bugs WHERE bug_id = ?',
- undef, $self->id);
- return $self->{votes};
-}
+################
+# Installation #
+################
sub db_schema_abstract_schema {
my ($self, $args) = @_;
@@ -123,6 +112,15 @@ sub install_update_db {
# Objects #
###########
+sub _bug_user_votes {
+ my ($self) = @_;
+ return $self->{'user_votes'} if exists $self->{'user_votes'};
+ $self->{'user_votes'} = Bugzilla->dbh->selectrow_array(
+ "SELECT vote_count FROM votes WHERE bug_id = ? AND who = ?",
+ undef, $self->id, Bugzilla->user->id);
+ return $self->{'user_votes'};
+}
+
sub object_columns {
my ($self, $args) = @_;
my ($class, $columns) = @$args{qw(class columns)};
@@ -678,7 +676,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 +723,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 +736,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 +746,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;
}
}
@@ -821,7 +819,7 @@ sub _remove_votes {
};
my $voter = new Bugzilla::User($userid);
- my $template = Bugzilla->template_inner($voter->setting('lang'));
+ my $template = Bugzilla->template_inner($voter->settings->{'lang'}->{'value'});
my $msg;
$template->process("voting/votes-removed.txt.tmpl", $vars, \$msg);
diff --git a/extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl b/extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl
index 15fb1efe0..af2b1c102 100644
--- a/extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl
+++ b/extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl
@@ -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>
@@ -82,15 +82,15 @@
<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 %]
diff --git a/extensions/Voting/template/en/default/hook/bug/edit-after_importance.html.tmpl b/extensions/Voting/template/en/default/hook/bug/edit-after_importance.html.tmpl
index f73ffaebd..b57a5cb27 100644
--- a/extensions/Voting/template/en/default/hook/bug/edit-after_importance.html.tmpl
+++ b/extensions/Voting/template/en/default/hook/bug/edit-after_importance.html.tmpl
@@ -29,6 +29,9 @@
[% ELSE %]
votes
[% END %]</a>
+ [% IF bug.user_votes %]
+ including you
+ [% END %]
[% END %]
(<a href="page.cgi?id=voting/user.html&amp;bug_id=
[%- bug.id FILTER uri %]#vote_
diff --git a/extensions/Voting/template/en/default/pages/voting/user.html.tmpl b/extensions/Voting/template/en/default/pages/voting/user.html.tmpl
index 61eaf8491..169e9995d 100644
--- a/extensions/Voting/template/en/default/pages/voting/user.html.tmpl
+++ b/extensions/Voting/template/en/default/pages/voting/user.html.tmpl
@@ -111,15 +111,8 @@
[% FOREACH bug = product.bugs %]
<tr [% IF bug.id == this_bug.id && canedit %]
class="bz_bug_being_voted_on" [% END %]>
- <td>
- [% IF bug.id == this_bug.id && canedit %]
- [% IF product.onevoteonly %]
- Vote For This [% terms.Bug %] &rarr;
- [% ELSE %]
- Enter Votes Here &rarr;
- [% END %]
- [%- END %]
- </td>
+ <td>[% IF bug.id == this_bug.id && canedit %]Enter New Vote here &rarr;
+ [%- END %]</td>
<td align="right"><a name="vote_[% bug.id FILTER html %]">
[% IF canedit %]
[% IF product.onevoteonly %]