#84 Passage du dernier post en cas de nécropost

This commit is contained in:
Eragon 2021-01-12 17:30:54 +01:00
parent c0ae3cc8ab
commit 4ddf60353c
No known key found for this signature in database
GPG Key ID: 41F8C3FE5948FDAB
2 changed files with 5 additions and 4 deletions

View File

@ -72,7 +72,7 @@ def forum_topic(f, page):
comments = t.thread.comments.paginate(page,
Thread.COMMENTS_PER_PAGE, True)
now_minus = datetime.datetime.now() - datetime.timedelta(minutes=15)
last_edited_comment = t.thread.comments.filter(Comment.date_modified >= now_minus).first()
now_minus = datetime.datetime.now() - datetime.timedelta(minutes=1)
last_updated_comment = t.thread.comments.filter(Comment.date_modified <= now_minus).first()
return render('/forum/topic.html', t=t, form=form, comments=comments, last=last_edited_comment)
return render('/forum/topic.html', t=t, form=form, comments=comments, last=last_updated_comment)

View File

@ -19,9 +19,10 @@
{{ widget_pagination.paginate(comments, 'forum_topic', t, {'f': t.forum}) }}
{% if not last %}
{% if last %}
<div class="bg-warn">
Ce topic est sans activité depuis plus de X jours, êtes-vous sûr de vouloir y poster ?
{{ last }}
</div>
{% endif %}