From afbef434b514b90a134f93ed043edd44bf564b64 Mon Sep 17 00:00:00 2001 From: Max Magorsch Date: Mon, 20 Apr 2020 02:49:26 +0200 Subject: Correctly display the user name in comments Signed-off-by: Max Magorsch --- web/packs/glsa.js | 2 +- web/packs/src/javascript/cvetool.js | 7 ++----- web/templates/dashboard/dashboard.tmpl | 2 +- web/templates/glsa/edit.tmpl | 3 ++- web/templates/glsa/show.tmpl | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) (limited to 'web') diff --git a/web/packs/glsa.js b/web/packs/glsa.js index 0490db0..8677dd7 100644 --- a/web/packs/glsa.js +++ b/web/packs/glsa.js @@ -66,7 +66,7 @@ function commentGLSA(glsaid, comment, commentType){ '
' + '
' + '' + - '' + + '' + '' + '' + '' + diff --git a/web/packs/src/javascript/cvetool.js b/web/packs/src/javascript/cvetool.js index 6158714..2a04c5b 100644 --- a/web/packs/src/javascript/cvetool.js +++ b/web/packs/src/javascript/cvetool.js @@ -218,7 +218,7 @@ function format ( d ) { 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 + '
' + commentDate + '
' + comment.Message + '
'; + comments = comments + '
' + comment.User.Name + '
' + commentDate + '
' + comment.Message + '
'; }); } @@ -315,9 +315,6 @@ function registerCommentListener(){ $( ".save-new-comment" ).click(function() { var cveid = $(this).data( "cveid" ); var comment = $('textarea.new-comment[data-cveid="' + cveid + '"]').val(); - console.log('textarea:'); - console.log(); - $.post( '/cve/comment/add', @@ -332,7 +329,7 @@ function registerCommentListener(){ 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 + '
' + commentDate + '
' + comment.Message + '
'; + var newComment = '
' + comment.User.Name + '
' + commentDate + '
' + comment.Message + '
'; $('.comments-section[data-cveid="' + cveid + '"]').append(newComment); } return diff --git a/web/templates/dashboard/dashboard.tmpl b/web/templates/dashboard/dashboard.tmpl index d77fd73..b6d3d2c 100644 --- a/web/templates/dashboard/dashboard.tmpl +++ b/web/templates/dashboard/dashboard.tmpl @@ -87,7 +87,7 @@ {{.Message}} - {{.User}} + {{.User.Name}} {{.Date}} diff --git a/web/templates/glsa/edit.tmpl b/web/templates/glsa/edit.tmpl index 4318d86..eed5c44 100644 --- a/web/templates/glsa/edit.tmpl +++ b/web/templates/glsa/edit.tmpl @@ -679,7 +679,7 @@
- + @@ -731,6 +731,7 @@

+ {{if .User.Permissions.Glsa.Approve}} {{if eq .Glsa.CreatorId .User.Id}} {{if .User.Permissions.Glsa.ApproveOwnGlsa}} diff --git a/web/templates/glsa/show.tmpl b/web/templates/glsa/show.tmpl index c9a9591..a07d471 100644 --- a/web/templates/glsa/show.tmpl +++ b/web/templates/glsa/show.tmpl @@ -412,7 +412,7 @@
- + -- cgit v1.2.3-65-gdbad