Aevann 2023-08-16 01:02:02 +03:00
parent 4b977054f2
commit 577b1e3780
2 changed files with 18 additions and 0 deletions

View File

@ -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!"}

View File

@ -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/<int:cid>")
@ -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/<int:cid>")