post-reply soft-deletion: keep current behaviour by not hard-deleting replies that have their own replies

This commit is contained in:
freamon 2024-10-18 08:20:18 +00:00
parent 7983105c58
commit df2dc6e020

View file

@ -195,6 +195,7 @@ def register(app):
for post_reply in PostReply.query.filter(PostReply.deleted == True, for post_reply in PostReply.query.filter(PostReply.deleted == True,
PostReply.posted_at < utcnow() - timedelta(days=7)).all(): PostReply.posted_at < utcnow() - timedelta(days=7)).all():
post_reply.delete_dependencies() post_reply.delete_dependencies()
if not post_reply.has_replies():
db.session.delete(post_reply) db.session.delete(post_reply)
db.session.commit() db.session.commit()