#84 Configuration de la durée avant nécropost

This commit is contained in:
Eragon 2021-01-12 17:34:50 +01:00
parent 4ddf60353c
commit 9273430f9a
No known key found for this signature in database
GPG Key ID: 41F8C3FE5948FDAB
2 changed files with 6 additions and 1 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=1)
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_updated_comment)

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