From e3e5536188cfec1e98571ed687ec8f96a261f8f2 Mon Sep 17 00:00:00 2001 From: Max Magorsch Date: Mon, 20 Apr 2020 17:20:35 +0200 Subject: Correctly sort the comments Signed-off-by: Max Magorsch --- web/packs/src/javascript/cvetool.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'web/packs/src/javascript/cvetool.js') diff --git a/web/packs/src/javascript/cvetool.js b/web/packs/src/javascript/cvetool.js index 0a48167..b43e806 100644 --- a/web/packs/src/javascript/cvetool.js +++ b/web/packs/src/javascript/cvetool.js @@ -227,8 +227,10 @@ function format ( d ) { var commentsObjects = JSON.parse(d[7]); comments = ''; commentsObjects.forEach(function (comment, index) { - var commentDate = '' + comment.Date.split("T")[0] + ' ' + comment.Date.split("T")[1].split(".")[0] + ' UTC'; - comments = comments + '
' + comment.User.Name + '
' + commentDate + '
' + comment.Message + '
'; + if(comment.Message != "") { + var commentDate = '' + comment.Date.split("T")[0] + ' ' + comment.Date.split("T")[1].split(".")[0] + ' UTC'; + comments = comments + '
' + comment.User.Name + '
' + commentDate + '
' + escape(comment.Message) + '
'; + } }); } @@ -335,11 +337,9 @@ function registerCommentListener(){ function(data) { if(data != "err") { - console.log("hi"); - console.log(data); var comment = JSON.parse(data); var commentDate = '' + comment.Date.split("T")[0] + ' ' + comment.Date.split("T")[1].split(".")[0] + ' UTC'; - var newComment = '
' + comment.User.Name + '
' + commentDate + '
' + comment.Message + '
'; + var newComment = '
' + comment.User.Name + '
' + commentDate + '
' + escape(comment.Message) + '
'; $('.comments-section[data-cveid="' + cveid + '"]').append(newComment); } return -- cgit v1.2.3-65-gdbad