]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 276605 : Ignore vote changes when usevotes = 0
authortravis%sedsystems.ca <>
Fri, 28 Jan 2005 03:14:22 +0000 (03:14 +0000)
committertravis%sedsystems.ca <>
Fri, 28 Jan 2005 03:14:22 +0000 (03:14 +0000)
Patch by Frederic Buclin <LpSolit@gmail.com>   r=wurblzap  a=myk

template/en/default/bug/votes/list-for-user.html.tmpl
votes.cgi

index 9bb3a1dd63684cc440a5719a3d13c5f569a5b0e8..968c66862b2528e09782fe6c49e56f200470ee4e 100644 (file)
 
 [% IF !header_done %]
   [% h2 = voting_user.login FILTER html %]
-  [% PROCESS global/header.html.tmpl title = "Show Votes" %]
+  [% IF canedit %]
+    [% title = "Change Votes" %]
+  [% ELSE %]
+    [% title = "Show Votes" %]
+  [% END %]
+  [% PROCESS global/header.html.tmpl %]
 [% ELSE %]
   <hr>
 [% END %]
 
-[% canedit = 1 IF voting_user.login == user.login %]
-
 [% IF votes_recorded %]
   <p>
     <font color="red">
index bbdbb34502f62059a61b04faafc1fd39a2b6ad3c..984d1f469febc579203c8f1bbd8477a8dd6ede88 100755 (executable)
--- a/votes.cgi
+++ b/votes.cgi
@@ -76,7 +76,7 @@ elsif ($action eq "show_user") {
     show_user();
 }
 elsif ($action eq "vote") {
-    record_votes();
+    record_votes() if Param('usevotes');
     show_user();
 }
 else {
@@ -128,8 +128,7 @@ sub show_user {
     my $who = DBNameToIdAndCheck($name);
     my $userid = Bugzilla->user ? Bugzilla->user->id : 0;
     
-    my $canedit = 1 if (Bugzilla->user &&
-                        $name eq Bugzilla->user->login);
+    my $canedit = (Param('usevotes') && $userid == $who) ? 1 : 0;
     
     SendSQL("LOCK TABLES bugs READ, products READ, votes WRITE,
              cc READ, bug_group_map READ, user_group_map READ,
@@ -214,7 +213,8 @@ sub show_user {
 
     SendSQL("DELETE FROM votes WHERE vote_count <= 0");
     SendSQL("UNLOCK TABLES");
-    
+
+    $vars->{'canedit'} = $canedit;
     $vars->{'voting_user'} = { "login" => $name };
     $vars->{'products'} = \@products;