[aur-dev] [PATCH] tu.php: Fix page showing a user hasn't voted when they have

canyonknight canyonknight at gmail.com
Mon Oct 8 21:22:20 EDT 2012


An ended vote details page will report a user hasn't voted even when
they have. This is a result of faulty logic that only checks if a user
has voted if the vote is still running.

Regression with commit c15441762c6f6ab4438eaf2854c0ee3146a98b30

Signed-off-by: canyonknight <canyonknight at gmail.com>
---
 web/html/tu.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/web/html/tu.php b/web/html/tu.php
index 5e85e78..e2f7712 100644
--- a/web/html/tu.php
+++ b/web/html/tu.php
@@ -42,10 +42,13 @@ if ($atype == "Trusted User" || $atype == "Developer") {
 				} else if ($row['User'] == username_from_sid($_COOKIE["AURSID"])) {
 					$canvote = 0;
 					$errorvote = __("You cannot vote in an proposal about you.");
-				} else if (tu_voted($row['ID'], uid_from_sid($_COOKIE["AURSID"]))) {
+				}
+				if (tu_voted($row['ID'], uid_from_sid($_COOKIE["AURSID"]))) {
 					$canvote = 0;
 					$hasvoted = 1;
-					$errorvote = __("You've already voted for this proposal.");
+					if ($isrunning) {
+						$errorvote = __("You've already voted for this proposal.");
+					}
 				}
 
 				if ($canvote == 1) {
-- 
1.7.12.2



More information about the aur-dev mailing list