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.
main
enginefeeder101 3 years ago
parent 519ef804a7
commit 6c83d25312
No known key found for this signature in database
GPG Key ID: CDB8B38253DF3390

@ -509,7 +509,8 @@ class User(Base, Email):
displayed_name = db.Column(db.String(160), nullable=False, default='') displayed_name = db.Column(db.String(160), nullable=False, default='')
spam_enabled = db.Column(db.Boolean, nullable=False, default=True) spam_enabled = db.Column(db.Boolean, nullable=False, default=True)
spam_mark_as_read = 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 # Flask-login attributes
is_authenticated = True is_authenticated = True

Loading…
Cancel
Save