diff options
author | 2020-04-20 17:20:35 +0200 | |
---|---|---|
committer | 2020-04-20 17:20:35 +0200 | |
commit | e3e5536188cfec1e98571ed687ec8f96a261f8f2 (patch) | |
tree | faf6564dd8e9bec18349b37270ad2f947ec0e1cd /web | |
parent | Correctly sort the comments (diff) | |
download | glsamaker-e3e5536188cfec1e98571ed687ec8f96a261f8f2.tar.gz glsamaker-e3e5536188cfec1e98571ed687ec8f96a261f8f2.tar.bz2 glsamaker-e3e5536188cfec1e98571ed687ec8f96a261f8f2.zip |
Correctly sort the comments
Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'web')
-rw-r--r-- | web/packs/src/javascript/cvetool.js | 10 |
1 files changed, 5 insertions, 5 deletions
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 = '<small class="text-muted">' + comment.Date.split("T")[0] + ' ' + comment.Date.split("T")[1].split(".")[0] + ' UTC</small>'; - comments = comments + '<div class="col-3 text-right mb-3"><b>' + comment.User.Name + '</b><br/>' + commentDate + '</div><div class="col-9 mb-3"><div class="card" style="background: none;"><div class="card-body">' + comment.Message + '</div></div></div>'; + if(comment.Message != "") { + var commentDate = '<small class="text-muted">' + comment.Date.split("T")[0] + ' ' + comment.Date.split("T")[1].split(".")[0] + ' UTC</small>'; + comments = comments + '<div class="col-3 text-right mb-3"><b>' + comment.User.Name + '</b><br/>' + commentDate + '</div><div class="col-9 mb-3"><div class="card" style="background: none;"><div class="card-body">' + escape(comment.Message) + '</div></div></div>'; + } }); } @@ -335,11 +337,9 @@ function registerCommentListener(){ function(data) { if(data != "err") { - console.log("hi"); - console.log(data); var comment = JSON.parse(data); var commentDate = '<small class="text-muted">' + comment.Date.split("T")[0] + ' ' + comment.Date.split("T")[1].split(".")[0] + ' UTC</small>'; - var newComment = '<div class="col-3 text-right mb-3"><b>' + comment.User.Name + '</b><br/>' + commentDate + '</div><div class="col-9 mb-3"><div class="card" style="background: none;"><div class="card-body">' + comment.Message + '</div></div></div>'; + var newComment = '<div class="col-3 text-right mb-3"><b>' + comment.User.Name + '</b><br/>' + commentDate + '</div><div class="col-9 mb-3"><div class="card" style="background: none;"><div class="card-body">' + escape(comment.Message) + '</div></div></div>'; $('.comments-section[data-cveid="' + cveid + '"]').append(newComment); } return |