1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-01-18 03:21:36 +02:00

Configurable default spam threshold used for new users

This commit adds functionality to set a custom default spam threshold
for new users. The environment variable ``DEFAULT_SPAM_THRESHOLD`` can
be used for this purpose. When not set, it defaults back to 80%, as the
default value was before
If ``DEFAULT_SPAM_THRESHOLD`` is set to a value that Python cannot
parse as an integer, a ValueError is thrown. There is no error handling
for that case built-in.
This commit is contained in:
enginefeeder101 2022-04-26 21:54:25 +02:00
parent 519ef804a7
commit 6c83d25312
No known key found for this signature in database
GPG Key ID: CDB8B38253DF3390

View File

@ -509,7 +509,8 @@ class User(Base, Email):
displayed_name = db.Column(db.String(160), nullable=False, default='')
spam_enabled = db.Column(db.Boolean, nullable=False, default=True)
spam_mark_as_read = db.Column(db.Boolean, nullable=False, default=True)
spam_threshold = db.Column(db.Integer, nullable=False, default=80)
spam_threshold = db.Column(db.Integer, nullable=False,
default=int(os.environ.get('DEFAULT_SPAM_THRESHOLD', 80)))
# Flask-login attributes
is_authenticated = True