forum: fix edit timestamp recording + display

On the preproduction server there are messages that have an edit
timestamp some 20 ns after their creation, for some reason.
This commit is contained in:
Lephe 2022-05-26 21:24:50 +01:00
parent c26861527b
commit 85323e896d
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 3 additions and 2 deletions

View File

@ -26,7 +26,7 @@ def edit_post(postid):
p = Post.query.filter_by(id=postid).first_or_404()
# Check permissions. TODO: Allow guests to edit their posts?
# Check permissions
if not current_user.can_edit_post(p):
abort(403)
@ -68,6 +68,7 @@ def edit_post(postid):
attachments.append((a, file))
db.session.add(a)
comment.touch()
db.session.add(comment)
if isinstance(p, Topic):

View File

@ -61,7 +61,7 @@
<td class="message">
<div class="info">
<div>Posté le <a href="{{ request.path }}#{{ c.id }}">{{ c.date_created | dyndate }}</a></div>
{% if c.date_created != c.date_modified %}
{% if (c.date_modified - c.date_created).seconds > 120 %}
<div>Modifié le <a href="{{ request.path }}#{{ c.id }}">{{ c.date_modified | dyndate }}</a></div>
{% endif %}
{{ post_actions(c) }}