mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Recalc community.post_reply_count after replies are purged as part of a post purge
This commit is contained in:
parent
502e6ff0f6
commit
d738850fc7
1 changed files with 3 additions and 0 deletions
|
@ -1387,6 +1387,9 @@ class Post(db.Model):
|
|||
db.session.execute(text('DELETE FROM "report" WHERE suspect_post_reply_id IN :reply_ids'), {'reply_ids': reply_ids})
|
||||
db.session.execute(text('DELETE FROM "post_reply" WHERE post_id = :post_id'), {'post_id': self.id})
|
||||
|
||||
self.community.post_reply_count = db.session.execute(text('SELECT COUNT(id) as c FROM "post_reply" WHERE community_id = :community_id AND deleted = false'),
|
||||
{'community_id': self.community_id}).scalar()
|
||||
|
||||
if self.image_id:
|
||||
file = File.query.get(self.image_id)
|
||||
file.delete_from_disk()
|
||||
|
|
Loading…
Reference in a new issue