count snappy/autojanny

remotes/1693045480750635534/spooky-22
atrc445 2021-08-22 13:58:41 +02:00
parent 663363b041
commit a68e85d451
2 changed files with 6 additions and 4 deletions

View File

@ -273,10 +273,6 @@ def api_comment(v):
g.db.add(c)
g.db.flush()
parent_post.comment_count = g.db.query(Comment).filter_by(parent_submission=parent_post.id).count()
g.db.add(parent_post)
g.db.flush()
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
file=request.files["file"]
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
@ -511,6 +507,9 @@ def api_comment(v):
v.comment_count = v.comments.filter(Comment.parent_submission != None).filter_by(is_banned=False, deleted_utc=0).count()
g.db.add(v)
parent_post.comment_count = g.db.query(Comment).filter_by(parent_submission=parent_post.id).count()
g.db.add(parent_post)
g.db.flush()
if request.headers.get("Authorization"): return c.json
else: return jsonify({"html": render_template("comments.html",

View File

@ -884,6 +884,9 @@ def submit_post(v):
g.db.add(c)
g.db.flush()
new_post.comment_count = g.db.query(Comment).filter_by(parent_submission=new_post.id).count()
g.db.add(new_post)
if "rdrama" in request.host:
if v.id == 995: body = "fuck off carp"
else: body = random.choice(snappyquotes)