From c1eaac912d262889398fc8a82aa07594bdf9c20a Mon Sep 17 00:00:00 2001 From: Adrien Joly Date: Thu, 17 Aug 2017 20:44:52 +0200 Subject: [PATCH] v0.9.3: bug fix: display "no comments" if there are only comments from other users --- package.json | 2 +- public/js/comment-selector.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 5cbfcb8..45a6290 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "trello-outliner-power-up", - "version": "0.9.2", + "version": "0.9.3", "description": "Comment Editor by AJ: a Trello Power-Up that allows you to edit card comments using an Outliner.", "homepage": "https://adrienjoly.com/trello-outliner", "main": "server/server.js", diff --git a/public/js/comment-selector.js b/public/js/comment-selector.js index a1bba0b..5e9fc82 100644 --- a/public/js/comment-selector.js +++ b/public/js/comment-selector.js @@ -33,13 +33,14 @@ t.get('member', 'private', 'token') t.remove('member', 'private', 'token'); // will cause auth popup to display on next click return; } - if (!res.comments.length) { + const comments = res.comments.filter(myOwnComment); + if (!comments.length) { const p = document.createElement('p'); p.appendChild(document.createTextNode('Please add a comment to your card first. Then, you will be able to edit it by clicking this button again.')); container.appendChild(p); return; } - res.comments.filter(myOwnComment).forEach(function(comment) { + comments.forEach(function(comment) { const li = document.createElement('li'); li.appendChild(document.createTextNode(comment.data.text)); li.addEventListener('click', function(){