From a225965cd09ccc16a82c37da0f45a298912a73ed Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 31 2019 20:04:48 +0000 Subject: Fix not showing the edit and delete buttons when they won't work If there is no identifier (which is the case when the comment is added using ajax rather than being received by SSE), the edit and delete buttons on the comment won't work, so there is no point in showing them, the users will just have to refresh the page to see them. In addition, this commit removes the link to the comment itself, for the same reason. Fixes https://pagure.io/pagure/issue/4210 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/static/request_ev.js b/pagure/static/request_ev.js index 7c39e6d..4fb56b7 100644 --- a/pagure/static/request_ev.js +++ b/pagure/static/request_ev.js @@ -41,23 +41,25 @@ add_comment = function(data, username) { + ' '+data.comment_user+'' + ' ' - + ' commented seconds ago' + if (data.comment_id) { + _data += ' href="#comment-' + data.comment_id + '"'; + } + _data += '>commented seconds ago' + ' ' + ' '; - if ( data.comment_user == username && data.comment_id !== 'undefined') { - _data = _data - + '
' - + ' ' - + ' ' - + ' ' - + ' ' - + '
' + if ( data.comment_user == username && data.comment_id !== undefined) { + _data = _data + + '
' + + ' ' + + ' ' + + ' ' + + ' ' + + '
'; } _data = _data