From 589ee8413a5d15cad7e1c335750d959f89590c1e Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Thu, 15 Aug 2024 21:04:52 +1200 Subject: [PATCH] only auto-delete non-sticky posts --- app/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/cli.py b/app/cli.py index a242d1aa..e905f8a2 100644 --- a/app/cli.py +++ b/app/cli.py @@ -175,7 +175,7 @@ def register(app): communities = Community.query.filter(Community.content_retention > 0).all() for community in communities: cut_off = utcnow() - timedelta(days=community.content_retention) - db.session.execute(text('UPDATE "post" SET deleted = true WHERE posted_at < :cut_off AND community_id = :community_id'), { + db.session.execute(text('UPDATE "post" SET deleted = true WHERE sticky = false AND posted_at < :cut_off AND community_id = :community_id'), { 'cut_off': cut_off, 'community_id': community.id })