allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject git commit: [#4981] Ticket voting buttons should only display if you have permission to vote
Date Mon, 30 Jun 2014 19:38:09 GMT
Repository: allura
Updated Branches:
  refs/heads/master 4cb87bf00 -> 8869cfd02


[#4981] Ticket voting buttons should only display if you have permission to vote

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/8869cfd0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/8869cfd0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/8869cfd0

Branch: refs/heads/master
Commit: 8869cfd025265d32c04e838e7495df72f5278e4a
Parents: 4cb87bf
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Sat Jun 28 21:29:41 2014 -0400
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Mon Jun 30 19:37:54 2014 +0000

----------------------------------------------------------------------
 Allura/allura/templates/widgets/vote.html               | 4 +++-
 ForgeTracker/forgetracker/tests/functional/test_root.py | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/8869cfd0/Allura/allura/templates/widgets/vote.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/vote.html b/Allura/allura/templates/widgets/vote.html
index c5b5f97..7a04a1c 100644
--- a/Allura/allura/templates/widgets/vote.html
+++ b/Allura/allura/templates/widgets/vote.html
@@ -21,6 +21,7 @@
                   and h.has_access(artifact, 'post')() %}
 {% set voted = artifact.user_voted(c.user) %}
 
+{% if can_vote %}
 <div id="vote" class="gray">
   <span class="btn-set duo">
   <a href="" class="btn {% if voted == 1 %}active{% endif %} {% if can_vote %}js-vote-up{%
endif %}" onclick="javascript:return false;">
@@ -31,7 +32,7 @@
   </a>
   </span>
   <div class="grid-8 vote-text">
-    <span class="votes-up">{{ artifact.votes_up }}</span> up votes | 
+    <span class="votes-up">{{ artifact.votes_up }}</span> up votes |
     <span class="votes-down">{{ artifact.votes_down }}</span> down votes |
     <span class="votes-percent">{{ artifact.votes_up_percent }}</span>%
   </div>
@@ -49,3 +50,4 @@
   </form>
   {% endif %}
 </div>
+{% endif %}

http://git-wip-us.apache.org/repos/asf/allura/blob/8869cfd0/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 8063873..e075112 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1829,6 +1829,10 @@ class TestFunctionalController(TrackerTestController):
         self.app.post('/admin/bugs/set_options',
                       params={'EnableVoting': 'true'})
 
+        # test vote form not visible to anon user
+        r = self.app.get('/bugs/1/', extra_environ=dict(username='*anonymous'))
+        assert_false(r.html.find('div', {'id': 'vote'}))
+
         r = self.app.get('/bugs/1/')
         votes_up = r.html.find('span', {'class': 'votes-up'})
         votes_down = r.html.find('span', {'class': 'votes-down'})


Mime
View raw message