forked from rDrama/rDrama
delete redis cache on post deletion/removal/undeletion/unremoval
parent
c415430888
commit
0a9b19bb15
|
@ -1352,6 +1352,10 @@ def remove_post(post_id, v):
|
||||||
|
|
||||||
v.pay_account('coins', 1)
|
v.pay_account('coins', 1)
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
|
for sort in COMMENT_SORTS:
|
||||||
|
cache.delete(f'post_{post.id}_{sort}')
|
||||||
|
|
||||||
return {"message": "Post removed!"}
|
return {"message": "Post removed!"}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1386,6 +1390,9 @@ def approve_post(post_id, v):
|
||||||
v.charge_account('coins', 1)
|
v.charge_account('coins', 1)
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
|
for sort in COMMENT_SORTS:
|
||||||
|
cache.delete(f'post_{post.id}_{sort}')
|
||||||
|
|
||||||
return {"message": "Post approved!"}
|
return {"message": "Post approved!"}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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()
|
v.post_count = g.db.query(Post).filter_by(author_id=v.id, deleted_utc=0).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
|
for sort in COMMENT_SORTS:
|
||||||
|
cache.delete(f'post_{p.id}_{sort}')
|
||||||
|
|
||||||
return {"message": "Post deleted!"}
|
return {"message": "Post deleted!"}
|
||||||
|
|
||||||
@app.post("/undelete_post/<int:pid>")
|
@app.post("/undelete_post/<int:pid>")
|
||||||
|
@ -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()
|
v.post_count = g.db.query(Post).filter_by(author_id=v.id, deleted_utc=0).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
|
for sort in COMMENT_SORTS:
|
||||||
|
cache.delete(f'post_{p.id}_{sort}')
|
||||||
|
|
||||||
return {"message": "Post undeleted!"}
|
return {"message": "Post undeleted!"}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue