From 85323e896d60912c8ced162b261fda1678bfd6be Mon Sep 17 00:00:00 2001 From: Lephe Date: Thu, 26 May 2022 21:24:50 +0100 Subject: [PATCH] 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. --- app/routes/posts/edit.py | 3 ++- app/templates/widgets/thread.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/routes/posts/edit.py b/app/routes/posts/edit.py index b62b2ee..ea988a3 100644 --- a/app/routes/posts/edit.py +++ b/app/routes/posts/edit.py @@ -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): diff --git a/app/templates/widgets/thread.html b/app/templates/widgets/thread.html index c315060..a1e87f7 100644 --- a/app/templates/widgets/thread.html +++ b/app/templates/widgets/thread.html @@ -61,7 +61,7 @@
Posté le {{ c.date_created | dyndate }}
- {% if c.date_created != c.date_modified %} + {% if (c.date_modified - c.date_created).seconds > 120 %}
Modifié le {{ c.date_modified | dyndate }}
{% endif %} {{ post_actions(c) }}