From d8686e5a14a6761b899aa834a6368372ea9c1489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 20 Oct 2016 16:34:33 +0200 Subject: [PATCH] Fixed comment rating --- src/scripts/tutti/2_comments.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scripts/tutti/2_comments.js b/src/scripts/tutti/2_comments.js index b73bb3bf..52a3803b 100644 --- a/src/scripts/tutti/2_comments.js +++ b/src/scripts/tutti/2_comments.js @@ -76,11 +76,16 @@ $(document).on('click','body .comment-action-rating',function(e){ e.preventDefault(); var $this = $(this); - var nodeId = $this.parent().parent().parent().data('node_id'); + var nodeId = $this.closest('.comment-container').data('node-id'); var is_positive = !$this.hasClass('down'); var parentDiv = $this.parent(); var rated_positive = parentDiv.hasClass('positive'); + if (typeof nodeId === 'undefined') { + if (console) console.log('Undefined node ID'); + return; + } + var op; if (parentDiv.hasClass('rated') && is_positive == rated_positive) { op = 'revoke';