Compare commits

...

2 Commits

3 changed files with 10 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(days=V5Config.NECROPOST_LIMIT)
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 %}

View File

@ -4,6 +4,7 @@ try:
from local_config import LocalConfig
except ImportError:
print(" \033[92mWARNING: Local config not found\033[0m")
class LocalConfig():
pass
@ -25,6 +26,7 @@ class Config(object):
# Do not attach cookies to cross-origin requests
SESSION_COOKIE_SAMESITE = "Lax"
class DefaultConfig(object):
"""Every value here can be overrided in the local_config.py class"""
# Domain
@ -50,6 +52,9 @@ class DefaultConfig(object):
# GLaDOS configuration
GLADOS_HOST = "127.0.0.1"
GLADOS_PORT = 5555
# Time in days before trigerring the nec
NECROPOST_LIMIT = 31
class V5Config(LocalConfig, DefaultConfig):
# Values put here cannot be overidden with local_config