From 2e80ebdc0d76ab66b3a750178b292ba33a443f97 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 13 Aug 2023 19:03:29 +0300 Subject: [PATCH] update comment ping cost on edit --- files/assets/js/comments_v.js | 4 ++++ files/routes/comments.py | 2 +- files/templates/comments.html | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index cd1812b12..b5205539d 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -218,6 +218,10 @@ function comment_edit(id){ document.getElementById('comment-edit-body-' + id).value = data["body"]; + const ping_cost = document.getElementById('comment-ping-cost-' + id) + ping_cost.innerText = data["ping_cost"]; + ping_cost.parentElement.classList.remove('d-none') + const input = ta.parentElement.querySelector('input[type="file"]') input.previousElementSibling.innerHTML = ''; input.value = null; diff --git a/files/routes/comments.py b/files/routes/comments.py index e4c29ddf5..1ade52257 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -680,4 +680,4 @@ def edit_comment(cid, v): g.db.flush() - return {"body": c.body, "comment": c.realbody(v)} + return {"body": c.body, "comment": c.realbody(v), "ping_cost": c.ping_cost} diff --git a/files/templates/comments.html b/files/templates/comments.html index 0311a3abd..1f198599a 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -224,9 +224,9 @@ {% endif %} {% endif %} - {% if c.ping_cost %} - spent {{c.ping_cost}} currency on pings - {% endif %} + + spent {{c.ping_cost}} currency on pings + {% if c.slots_result %} {{c.slots_result}}