diff --git a/files/routes/admin.py b/files/routes/admin.py index 1fe0adda6..75edec1dc 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1352,6 +1352,10 @@ def remove_post(post_id, v): v.pay_account('coins', 1) g.db.add(v) + + for sort in COMMENT_SORTS: + cache.delete(f'post_{post.id}_{sort}') + return {"message": "Post removed!"} @@ -1386,6 +1390,9 @@ def approve_post(post_id, v): v.charge_account('coins', 1) g.db.add(v) + for sort in COMMENT_SORTS: + cache.delete(f'post_{post.id}_{sort}') + return {"message": "Post approved!"} diff --git a/files/routes/posts.py b/files/routes/posts.py index a0901f8c4..cb4596501 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -777,6 +777,9 @@ def delete_post_pid(pid, v): v.post_count = g.db.query(Post).filter_by(author_id=v.id, deleted_utc=0).count() g.db.add(v) + for sort in COMMENT_SORTS: + cache.delete(f'post_{p.id}_{sort}') + return {"message": "Post deleted!"} @app.post("/undelete_post/") @@ -799,6 +802,9 @@ def undelete_post_pid(pid, v): v.post_count = g.db.query(Post).filter_by(author_id=v.id, deleted_utc=0).count() g.db.add(v) + for sort in COMMENT_SORTS: + cache.delete(f'post_{p.id}_{sort}') + return {"message": "Post undeleted!"}