Fix rating on comments
This commit is contained in:
@@ -181,6 +181,7 @@ def comments_for_node(node_id):
|
|||||||
some_comment['_user'] = subquery.get_user_info(some_comment['user'])
|
some_comment['_user'] = subquery.get_user_info(some_comment['user'])
|
||||||
some_comment['_is_own'] = some_comment['user'] == current_user.objectid
|
some_comment['_is_own'] = some_comment['user'] == current_user.objectid
|
||||||
some_comment['_current_user_rating'] = None # tri-state boolean
|
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:
|
if current_user.is_authenticated:
|
||||||
for rating in some_comment.properties.ratings or ():
|
for rating in some_comment.properties.ratings or ():
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
.comment-meta
|
.comment-meta
|
||||||
.comment-rating(
|
.comment-rating(
|
||||||
class="{% if comment._current_user_rating is not none %}rated{% if comment._current_user_rating %} positive{% endif %}{% endif %}")
|
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 %}
|
| {% if not comment._is_own %}
|
||||||
.comment-action-rating.up(title="Like comment")
|
.comment-action-rating.up(title="Like comment")
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
|
Reference in New Issue
Block a user