diff --git a/files/routes/admin.py b/files/routes/admin.py index f9631ea6a..4bbead621 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1619,6 +1619,10 @@ def remove_comment(c_id, v): ) g.db.add(ma) + if comment.parent_post: + for sort in COMMENT_SORTS: + cache.delete(f'post_{comment.parent_post}_{sort}') + return {"message": "Comment removed!"} @@ -1648,6 +1652,10 @@ def approve_comment(c_id, v): g.db.add(comment) + if comment.parent_post: + for sort in COMMENT_SORTS: + cache.delete(f'post_{comment.parent_post}_{sort}') + return {"message": "Comment approved!"} diff --git a/files/routes/comments.py b/files/routes/comments.py index 0d6e79147..37142907e 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -434,6 +434,11 @@ def delete_comment(cid, v): g.db.add(v) cache.delete_memoized(comment_idlist) + + if c.parent_post: + for sort in COMMENT_SORTS: + cache.delete(f'post_{c.parent_post}_{sort}') + return {"message": "Comment deleted!"} @app.post("/undelete/comment/") @@ -454,6 +459,11 @@ def undelete_comment(cid, v): g.db.add(v) cache.delete_memoized(comment_idlist) + + if c.parent_post: + for sort in COMMENT_SORTS: + cache.delete(f'post_{c.parent_post}_{sort}') + return {"message": "Comment undeleted!"} @app.post("/pin_comment/")