diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index c572674ae..41aa08ae4 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -324,6 +324,12 @@ function post_comment(fullname, hide){ remove_dialog(); if (fullname.startsWith('c_')) restore_reply_buttons(fullname) + + if (fullname.startsWith('p_')) { + const viewbtn = document.getElementById('viewbtn') + if (viewbtn) + viewbtn.dataset.ids = viewbtn.dataset.ids.slice(0, -1) + `, ${data['id']}]` + } } else { showToast(false, getMessageFromJsonData(false, data)); diff --git a/files/routes/comments.py b/files/routes/comments.py index f2de1cea7..c31922a59 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -426,7 +426,7 @@ def comment(v): gevent.spawn(postprocess_comment, c.body, c.body_html, c.id) if v.client: return c.json - return {"comment": render_template("comments.html", v=v, comments=[c])} + return {"id": c.id, "comment": render_template("comments.html", v=v, comments=[c])} @app.post("/delete/comment/") @limiter.limit('1/second', scope=rpath)