From bcfe98c295e2846d6826d79911e51f4d3234b40f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 18 Nov 2022 21:58:12 +0200 Subject: [PATCH] remove hole pins when post moved --- files/helpers/cron.py | 1 + files/routes/reporting.py | 1 + files/routes/subs.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 6ecf39345..26d0d74ec 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -91,6 +91,7 @@ def _sub_inactive_purge_task(): posts = g.db.query(Submission).filter(Submission.sub.in_(names)).all() for post in posts: post.sub = None + post.hole_pinned = None g.db.add(post) to_delete = mods \ diff --git a/files/routes/reporting.py b/files/routes/reporting.py index fa51de293..865bd2476 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -156,6 +156,7 @@ def move_post(post:Submission, v:User, reason:str) -> Union[bool, str]: abort(403, f"@{post.author.username} needs to be a member of House {sub_to.capitalize()} for their post to be moved to /h/{sub_to}") post.sub = sub_to + post.hole_pinned = None g.db.add(post) if v.id != post.author_id: diff --git a/files/routes/subs.py b/files/routes/subs.py index e9a49d41d..8b6a8c2b9 100644 --- a/files/routes/subs.py +++ b/files/routes/subs.py @@ -360,7 +360,8 @@ def kick(v, pid): old = post.sub post.sub = None - + post.hole_pinned = None + ma = SubAction( sub=old, kind='kick_post',