From 64594b48eb94e38417d4930b8ea9490c93b81205 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 14 Aug 2022 08:05:24 +0200 Subject: [PATCH] fix what sneks said about hole deletion crash when one of the mods is a site janny --- files/helpers/cron.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 79574a7941..b02a1fcaf7 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -58,7 +58,10 @@ def sub_inactive_purge_task(): for x in mods: send_repeatable_notification(x.user_id, f":marseyrave: /h/{x.sub} has been deleted for inactivity after one week without new posts. All posts in it have been moved to the main feed :marseyrave:") - admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level > 1).all()] + mods_ids = [x.user_id for x in mods] + + admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level > 1, User.id.notin_(mods_ids)).all()] + for name in names: for admin in admins: send_repeatable_notification(admin, f":marseyrave: /h/{name} has been deleted for inactivity after one week without new posts. All posts in it have been moved to the main feed :marseyrave:")