From 6faea83372ddae79361dfa9ad60624d52c107838 Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Tue, 1 Nov 2016 19:28:46 +0100 Subject: [PATCH] Fix rating on comments --- pillar/web/nodes/custom/comments.py | 1 + src/templates/nodes/custom/comment/_macros.jade | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pillar/web/nodes/custom/comments.py b/pillar/web/nodes/custom/comments.py index e04fdca2..c2c2861b 100644 --- a/pillar/web/nodes/custom/comments.py +++ b/pillar/web/nodes/custom/comments.py @@ -181,6 +181,7 @@ def comments_for_node(node_id): some_comment['_user'] = subquery.get_user_info(some_comment['user']) some_comment['_is_own'] = some_comment['user'] == current_user.objectid some_comment['_current_user_rating'] = None # tri-state boolean + some_comment['_rating'] = some_comment.properties.rating_positive - some_comment.properties.rating_negative if current_user.is_authenticated: for rating in some_comment.properties.ratings or (): diff --git a/src/templates/nodes/custom/comment/_macros.jade b/src/templates/nodes/custom/comment/_macros.jade index 90cb26e5..8648c0c0 100644 --- a/src/templates/nodes/custom/comment/_macros.jade +++ b/src/templates/nodes/custom/comment/_macros.jade @@ -22,7 +22,7 @@ .comment-meta .comment-rating( class="{% if comment._current_user_rating is not none %}rated{% if comment._current_user_rating %} positive{% endif %}{% endif %}") - .comment-rating-value(title="Number of likes") {{ rating }} + .comment-rating-value(title="Number of likes") {{ comment._rating }} | {% if not comment._is_own %} .comment-action-rating.up(title="Like comment") | {% endif %}