diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 85bacff58a..dd32c49f5d 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -88,6 +88,10 @@ def add_notif(cid, uid): def NOTIFY_USERS(text, v): + # Restrict young accounts from generating notifications + if v.age < NOTIFICATION_SPAM_AGE_THRESHOLD: + return set() + notify_users = set() for word, id in NOTIFIED_USERS.items(): if id == 0 or v.id == id: continue diff --git a/files/helpers/const.py b/files/helpers/const.py index e38e3f0caa..c6757aa5b0 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -168,6 +168,7 @@ PIN_LIMIT = 3 POST_RATE_LIMIT = '1/second;2/minute;10/hour;50/day' LOGGEDIN_ACTIVE_TIME = 15 * 60 PFP_DEFAULT_MARSEY = True +NOTIFICATION_SPAM_AGE_THRESHOLD = 3 * 86400 HOLE_NAME = 'hole' HOLE_STYLE_FLAIR = False diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 9282cc716f..79574a7941 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -1,6 +1,7 @@ from files.cli import g, app, db_session import click from files.helpers.const import * +from files.helpers.alerts import send_repeatable_notification from files.classes import * import files.helpers.lottery as lottery @@ -48,6 +49,7 @@ def sub_inactive_purge_task(): one_week_ago = time.time() - 604800 active_holes = [x[0] for x in g.db.query(Submission.sub).distinct() \ .filter(Submission.sub != None, Submission.created_utc > one_week_ago).all()] + active_holes.append('changelog') # system hole immune from deletion dead_holes = g.db.query(Sub).filter(Sub.name.notin_(active_holes)).all() names = [x.name for x in dead_holes] diff --git a/site_settings.json b/site_settings.json index 3cfdf6fd56..ce4adeee72 100644 --- a/site_settings.json +++ b/site_settings.json @@ -1 +1 @@ -{"Bots": true, "Fart mode": false, "Read-only mode": false, "Signups": true} \ No newline at end of file +{"Bots": true, "Fart mode": true, "Read-only mode": false, "Signups": true} \ No newline at end of file