This commit is contained in:
Aevann1 2021-09-13 13:18:19 +02:00
parent d2687c8338
commit a8f8afa093
5 changed files with 5 additions and 6 deletions

View file

@ -246,8 +246,9 @@ def before_request():
@app.after_request
def after_request(response):
g.db.commit()
g.db.close()
if g.db:
g.db.commit()
g.db.close()
response.headers.add("Strict-Transport-Security", "max-age=31536000")
response.headers.add("Referrer-Policy", "same-origin")

View file

@ -62,7 +62,7 @@ def check_ban_evade(v):
post.ban_reason="ban evasion"
g.db.add(post)
g.db.commit()
g.db.flush()
ma=ModAction(
kind="ban_post",

View file

@ -590,7 +590,6 @@ def api_comment(v):
parent_post.comment_count = g.db.query(Comment).filter_by(parent_submission=parent_post.id).count()
g.db.add(parent_post)
g.db.commit()
if request.headers.get("Authorization"): return c.json
else: return jsonify({"html": render_template("comments.html",

View file

@ -367,7 +367,7 @@ def sign_up_post(v):
)
g.db.add(new_user)
g.db.commit()
g.db.flush()
# give a beta badge
beta_badge = Badge(user_id=new_user.id,

View file

@ -270,7 +270,6 @@ def messagereply(v):
g.db.add(new_aux)
notif = Notification(comment_id=new_comment.id, user_id=user.id)
g.db.add(notif)
g.db.commit()
cache.delete_memoized(User.notification_messages, user)
return jsonify({"html": render_template("comments.html",