aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2010-07-16 11:41:42 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2010-07-16 11:41:42 +0200
commit7edcb0dc22c61bed763581d91295c4edae72c17f (patch)
tree8f9f5c27740d29d6709059eaae6e39cfe0c444ab
parentaf968de8d04f9b3d38a1be9e4f02624b55ff54f1 (diff)
downloadbugs-7edcb0dc22c61bed763581d91295c4edae72c17f.tar
bugs-7edcb0dc22c61bed763581d91295c4edae72c17f.tar.gz
bugs-7edcb0dc22c61bed763581d91295c4edae72c17f.tar.bz2
bugs-7edcb0dc22c61bed763581d91295c4edae72c17f.tar.xz
bugs-7edcb0dc22c61bed763581d91295c4edae72c17f.zip
Bug 578258: Calling votes.cgi with no arguments should either display the user's votes, or give a better error message if the extension is disabled
r/a=mkanat
-rw-r--r--template/en/default/global/code-error.html.tmpl5
-rwxr-xr-xvotes.cgi7
2 files changed, 9 insertions, 3 deletions
diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl
index f37b6a452..dd05c239a 100644
--- a/template/en/default/global/code-error.html.tmpl
+++ b/template/en/default/global/code-error.html.tmpl
@@ -147,6 +147,11 @@
address.
[% END %]
+ [% ELSIF error == "extension_disabled" %]
+ [% title = "Extension Disabled" %]
+ You cannot access this page because the extension '[% name FILTER html %]'
+ is disabled.
+
[% ELSIF error == "extension_must_be_subclass" %]
<code>[% package FILTER html %]</code> from
<code>[% filename FILTER html %]</code> is not a subclass of
diff --git a/votes.cgi b/votes.cgi
index dfbadfabc..ef9227af0 100755
--- a/votes.cgi
+++ b/votes.cgi
@@ -28,10 +28,11 @@ use lib qw(. lib);
use Bugzilla;
use Bugzilla::Error;
-my $cgi = Bugzilla->cgi;
+my $is_enabled = grep { $_->NAME eq 'Voting' } @{ Bugzilla->extensions };
+$is_enabled || ThrowCodeError('extension_disabled', { name => 'Voting' });
-my $to_url;
-my $action = $cgi->param('action');
+my $cgi = Bugzilla->cgi;
+my $action = $cgi->param('action') || 'show_user';
if ($action eq "show_bug") {
$cgi->delete('action');