From: Frédéric Buclin Date: Fri, 16 Jul 2010 09:46:20 +0000 (+0200) Subject: Bug 578258: Calling votes.cgi with no arguments should either display the user's... X-Git-Tag: bugzilla-3.7.3~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c71f18e78a68ea0ba5d6c0be5512059985206fd;p=thirdparty%2Fbugzilla.git 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 --- diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl index 177d47621d..8b9e070c9d 100644 --- a/template/en/default/global/code-error.html.tmpl +++ b/template/en/default/global/code-error.html.tmpl @@ -146,6 +146,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" %] [% package FILTER html %] from [% filename FILTER html %] is not a subclass of diff --git a/votes.cgi b/votes.cgi index dfbadfabc1..ef9227af05 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');