From e53a286d49a1721bac99b60209bc865ce70c2462 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Jun 2022 17:41:33 +0200 Subject: [PATCH] notify mods of the deletion of their holes --- files/routes/subs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/routes/subs.py b/files/routes/subs.py index b62ec0d50e..1bae89c799 100644 --- a/files/routes/subs.py +++ b/files/routes/subs.py @@ -461,12 +461,16 @@ def sub_inactive_purge_task(): dead_holes = g.db.query(Sub).filter(Sub.name.notin_(active_holes)).all() names = [x.name for x in dead_holes] + mods = g.db.query(Mod).filter(Mod.sub.in_(names)).all() + 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:") + posts = g.db.query(Submission).filter(Submission.sub.in_(names)).all() for post in posts: post.sub = None g.db.add(post) - to_delete = g.db.query(Mod).filter(Mod.sub.in_(names)).all() \ + to_delete = mods \ + g.db.query(Exile).filter(Exile.sub.in_(names)).all() \ + g.db.query(SubBlock).filter(SubBlock.sub.in_(names)).all() \ + g.db.query(SubSubscription).filter(SubSubscription.sub.in_(names)).all()