summaryrefslogtreecommitdiffstats
path: root/extensions/Voting
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/Voting')
-rw-r--r--extensions/Voting/Extension.pm14
-rw-r--r--extensions/Voting/disabled0
-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.tmpl2
4 files changed, 18 insertions, 1 deletions
diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm
index a5a3bc11b..aecd2382c 100644
--- a/extensions/Voting/Extension.pm
+++ b/extensions/Voting/Extension.pm
@@ -47,6 +47,10 @@ use constant DEFAULT_VOTES_PER_BUG => 1;
use constant CMT_POPULAR_VOTES => 3;
use constant REL_VOTER => 4;
+BEGIN {
+ *Bugzilla::Bug::user_votes = \&_bug_user_votes;
+}
+
################
# Installation #
################
@@ -122,6 +126,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)};
@@ -408,6 +421,7 @@ sub _page_user {
# If a bug_id is given, and we're editing, we'll add it to the votes list.
my $bug_id = $input->{bug_id};
+ $bug_id = $bug_id->[0] if ref($bug_id) eq 'ARRAY';
my $bug = Bugzilla::Bug->check($bug_id) if $bug_id;
my $who_id = $input->{user_id} || $user->id;
diff --git a/extensions/Voting/disabled b/extensions/Voting/disabled
deleted file mode 100644
index e69de29bb..000000000
--- a/extensions/Voting/disabled
+++ /dev/null
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..18221bda1 100644
--- a/extensions/Voting/template/en/default/pages/voting/user.html.tmpl
+++ b/extensions/Voting/template/en/default/pages/voting/user.html.tmpl
@@ -134,7 +134,7 @@
[% END %]
</a></td>
<td align="center">
- [% bug.id FILTER bug_link(bug) FILTER none %]
+ [% bug.id FILTER bug_link(bug.id) FILTER none %]
</td>
<td>
[% bug.summary FILTER html %]