fd
This commit is contained in:
parent
d2687c8338
commit
a8f8afa093
5 changed files with 5 additions and 6 deletions
|
@ -246,6 +246,7 @@ def before_request():
|
||||||
@app.after_request
|
@app.after_request
|
||||||
def after_request(response):
|
def after_request(response):
|
||||||
|
|
||||||
|
if g.db:
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
g.db.close()
|
g.db.close()
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ def check_ban_evade(v):
|
||||||
post.ban_reason="ban evasion"
|
post.ban_reason="ban evasion"
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
|
|
||||||
g.db.commit()
|
g.db.flush()
|
||||||
|
|
||||||
ma=ModAction(
|
ma=ModAction(
|
||||||
kind="ban_post",
|
kind="ban_post",
|
||||||
|
|
|
@ -590,7 +590,6 @@ def api_comment(v):
|
||||||
|
|
||||||
parent_post.comment_count = g.db.query(Comment).filter_by(parent_submission=parent_post.id).count()
|
parent_post.comment_count = g.db.query(Comment).filter_by(parent_submission=parent_post.id).count()
|
||||||
g.db.add(parent_post)
|
g.db.add(parent_post)
|
||||||
g.db.commit()
|
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return c.json
|
if request.headers.get("Authorization"): return c.json
|
||||||
else: return jsonify({"html": render_template("comments.html",
|
else: return jsonify({"html": render_template("comments.html",
|
||||||
|
|
|
@ -367,7 +367,7 @@ def sign_up_post(v):
|
||||||
)
|
)
|
||||||
|
|
||||||
g.db.add(new_user)
|
g.db.add(new_user)
|
||||||
g.db.commit()
|
g.db.flush()
|
||||||
|
|
||||||
# give a beta badge
|
# give a beta badge
|
||||||
beta_badge = Badge(user_id=new_user.id,
|
beta_badge = Badge(user_id=new_user.id,
|
||||||
|
|
|
@ -270,7 +270,6 @@ def messagereply(v):
|
||||||
g.db.add(new_aux)
|
g.db.add(new_aux)
|
||||||
notif = Notification(comment_id=new_comment.id, user_id=user.id)
|
notif = Notification(comment_id=new_comment.id, user_id=user.id)
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
g.db.commit()
|
|
||||||
cache.delete_memoized(User.notification_messages, user)
|
cache.delete_memoized(User.notification_messages, user)
|
||||||
|
|
||||||
return jsonify({"html": render_template("comments.html",
|
return jsonify({"html": render_template("comments.html",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue