update comment ping cost on edit

pull/195/head
Aevann 2023-08-13 19:03:29 +03:00
parent 4623e7c1a3
commit 2e80ebdc0d
3 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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}

View File

@ -224,9 +224,9 @@
{% endif %}
{% endif %}
{% if c.ping_cost %}
<em class="ml-2">spent {{c.ping_cost}} currency on pings</em>
{% endif %}
<em class="ml-2 {% if not c.ping_cost %}d-none{% endif %}">
spent <span id="comment-ping-cost-{{c.id}}">{{c.ping_cost}}</span> currency on pings
</em>
{% if c.slots_result %}
<em class="ml-2">{{c.slots_result}}</em>