forked from rDrama/rDrama
update edited_string when editing comments
parent
2974623340
commit
1964c65f17
|
@ -224,6 +224,12 @@ function comment_edit(id){
|
|||
ping_cost.parentElement.classList.remove('d-none')
|
||||
}
|
||||
|
||||
if (data["edited_string"]) {
|
||||
const edited_string = document.getElementById('comment-edited_string-' + id)
|
||||
edited_string.innerText = data["edited_string"]
|
||||
edited_string.parentElement.classList.remove('d-none')
|
||||
}
|
||||
|
||||
const input = ta.parentElement.querySelector('input[type="file"]')
|
||||
input.previousElementSibling.innerHTML = '';
|
||||
input.value = null;
|
||||
|
|
|
@ -187,6 +187,7 @@ class Comment(Base):
|
|||
@property
|
||||
@lazy
|
||||
def edited_string(self):
|
||||
if not self.edited_utc: return None
|
||||
return make_age_string(self.edited_utc)
|
||||
|
||||
@property
|
||||
|
|
|
@ -680,4 +680,9 @@ def edit_comment(cid, v):
|
|||
|
||||
|
||||
g.db.flush()
|
||||
return {"body": c.body, "comment": c.realbody(v), "ping_cost": c.ping_cost}
|
||||
return {
|
||||
"body": c.body,
|
||||
"comment": c.realbody(v),
|
||||
"ping_cost": c.ping_cost,
|
||||
"edited_string": c.edited_string,
|
||||
}
|
||||
|
|
|
@ -201,9 +201,9 @@
|
|||
{% endif %}
|
||||
#{{c.id}}
|
||||
|
||||
{% if c.edited_utc %}
|
||||
<span class="time-edited" id="time-edit-{{c.id}}" data-nonce="{{g.nonce}}" data-onmouseover="timestamp(this, '{{c.edited_utc}}')"><span>·</span> <span class="font-italic d-inline-block">Edited {{c.edited_string}}</span></span>
|
||||
{% endif %}
|
||||
<span class="{% if not c.edited_utc %}d-none{% endif %} font-italic" data-nonce="{{g.nonce}}" data-onmouseover="timestamp(this, '{{c.edited_utc}}')">
|
||||
Edited <span id="comment-edited_string-{{c.id}}">{{c.edited_string}}</span>
|
||||
</span>
|
||||
|
||||
{% if c.treasure_amount and c.treasure_amount != '0' %}
|
||||
{% if c.treasure_amount.startswith('l') %}
|
||||
|
|
Loading…
Reference in New Issue