forked from rDrama/rDrama
remove unnecessary flushes
parent
333e1329f9
commit
a94dda90dd
|
@ -61,8 +61,6 @@ def notif_comment(text):
|
||||||
|
|
||||||
text_html = sanitize(text, blackjack="notification")
|
text_html = sanitize(text, blackjack="notification")
|
||||||
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
existing = g.db.query(Comment.id).filter(
|
existing = g.db.query(Comment.id).filter(
|
||||||
Comment.author_id == AUTOJANNY_ID,
|
Comment.author_id == AUTOJANNY_ID,
|
||||||
Comment.parent_post == None,
|
Comment.parent_post == None,
|
||||||
|
@ -78,8 +76,6 @@ def notif_comment(text):
|
||||||
n.comment_id = replace_with
|
n.comment_id = replace_with
|
||||||
g.db.add(n)
|
g.db.add(n)
|
||||||
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
for c in g.db.query(Comment).filter(Comment.id.in_(replaced)).all():
|
for c in g.db.query(Comment).filter(Comment.id.in_(replaced)).all():
|
||||||
g.db.delete(c)
|
g.db.delete(c)
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,6 @@ def _sub_inactive_purge_task():
|
||||||
|
|
||||||
for x in to_delete:
|
for x in to_delete:
|
||||||
g.db.delete(x)
|
g.db.delete(x)
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
for x in dead_holes:
|
for x in dead_holes:
|
||||||
g.db.delete(x)
|
g.db.delete(x)
|
||||||
|
|
|
@ -696,7 +696,6 @@ def admin_add_alt(v:User, username):
|
||||||
is_manual=True,
|
is_manual=True,
|
||||||
)
|
)
|
||||||
g.db.add(a)
|
g.db.add(a)
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
cache.delete_memoized(get_alt_graph_ids, user1.id)
|
cache.delete_memoized(get_alt_graph_ids, user1.id)
|
||||||
cache.delete_memoized(get_alt_graph_ids, user2.id)
|
cache.delete_memoized(get_alt_graph_ids, user2.id)
|
||||||
|
|
|
@ -361,8 +361,6 @@ def approve_hat(v, name):
|
||||||
hat.description = description
|
hat.description = description
|
||||||
g.db.add(hat)
|
g.db.add(hat)
|
||||||
|
|
||||||
|
|
||||||
g.db.flush()
|
|
||||||
author = hat.author
|
author = hat.author
|
||||||
|
|
||||||
all_by_author = g.db.query(HatDef).filter_by(author_id=author.id).count()
|
all_by_author = g.db.query(HatDef).filter_by(author_id=author.id).count()
|
||||||
|
|
|
@ -108,7 +108,6 @@ def buy(v:User, award):
|
||||||
lootbox_items.append(AWARDS[lb_award]['title'])
|
lootbox_items.append(AWARDS[lb_award]['title'])
|
||||||
lb_award = AwardRelationship(user_id=v.id, kind=lb_award, price_paid=price // LOOTBOX_ITEM_COUNT)
|
lb_award = AwardRelationship(user_id=v.id, kind=lb_award, price_paid=price // LOOTBOX_ITEM_COUNT)
|
||||||
g.db.add(lb_award)
|
g.db.add(lb_award)
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
v.lootboxes_bought += 1
|
v.lootboxes_bought += 1
|
||||||
lootbox_msg = "You open your lootbox and receive: " + ', '.join(lootbox_items)
|
lootbox_msg = "You open your lootbox and receive: " + ', '.join(lootbox_items)
|
||||||
|
|
|
@ -43,7 +43,6 @@ def create_group(v):
|
||||||
|
|
||||||
group = Group(name=name)
|
group = Group(name=name)
|
||||||
g.db.add(group)
|
g.db.add(group)
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
group_membership = GroupMembership(
|
group_membership = GroupMembership(
|
||||||
user_id=v.id,
|
user_id=v.id,
|
||||||
|
|
|
@ -321,8 +321,6 @@ def sign_up_post(v:Optional[User]):
|
||||||
|
|
||||||
g.db.add(new_user)
|
g.db.add(new_user)
|
||||||
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
if ref_id:
|
if ref_id:
|
||||||
ref_user = get_account(ref_id)
|
ref_user = get_account(ref_id)
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,6 @@ def notifications_modmail(v):
|
||||||
total = comments.count()
|
total = comments.count()
|
||||||
listing = comments.order_by(Comment.id.desc()).offset(PAGE_SIZE*(page-1)).limit(PAGE_SIZE).all()
|
listing = comments.order_by(Comment.id.desc()).offset(PAGE_SIZE*(page-1)).limit(PAGE_SIZE).all()
|
||||||
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
if v.client: return {"data":[x.json for x in listing]}
|
if v.client: return {"data":[x.json for x in listing]}
|
||||||
|
|
||||||
return render_template("notifications.html",
|
return render_template("notifications.html",
|
||||||
|
@ -411,8 +409,6 @@ def notifications(v:User):
|
||||||
all_cids = set(all_cids)
|
all_cids = set(all_cids)
|
||||||
output = get_comments_v_properties(v, None, Comment.id.in_(all_cids))[1]
|
output = get_comments_v_properties(v, None, Comment.id.in_(all_cids))[1]
|
||||||
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
if v.client: return {"data":[x.json for x in listing]}
|
if v.client: return {"data":[x.json for x in listing]}
|
||||||
|
|
||||||
return render_template("notifications.html",
|
return render_template("notifications.html",
|
||||||
|
|
|
@ -52,7 +52,6 @@ def add_alt(user1:int, user2:int):
|
||||||
if not existing:
|
if not existing:
|
||||||
new_alt = Alt(user1=user1, user2=user2)
|
new_alt = Alt(user1=user1, user2=user2)
|
||||||
g.db.add(new_alt)
|
g.db.add(new_alt)
|
||||||
g.db.flush()
|
|
||||||
cache.delete_memoized(get_alt_graph_ids, user1)
|
cache.delete_memoized(get_alt_graph_ids, user1)
|
||||||
cache.delete_memoized(get_alt_graph_ids, user2)
|
cache.delete_memoized(get_alt_graph_ids, user2)
|
||||||
|
|
||||||
|
@ -80,7 +79,7 @@ def check_for_alts(current:User, include_current_session=False):
|
||||||
past_accs.add(current_id)
|
past_accs.add(current_id)
|
||||||
if include_current_session:
|
if include_current_session:
|
||||||
session["history"] = list(past_accs)
|
session["history"] = list(past_accs)
|
||||||
g.db.flush()
|
|
||||||
for u in get_alt_graph(current.id):
|
for u in get_alt_graph(current.id):
|
||||||
if u.shadowbanned and not current.shadowbanned:
|
if u.shadowbanned and not current.shadowbanned:
|
||||||
current.shadowbanned = u.shadowbanned
|
current.shadowbanned = u.shadowbanned
|
||||||
|
|
|
@ -530,7 +530,6 @@ def settings_security_post(v):
|
||||||
|
|
||||||
v.mfa_secret = None
|
v.mfa_secret = None
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.flush()
|
|
||||||
return render_template("settings/security.html", v=v, msg="Two-factor authentication disabled!")
|
return render_template("settings/security.html", v=v, msg="Two-factor authentication disabled!")
|
||||||
|
|
||||||
@app.post("/settings/log_out_all_others")
|
@app.post("/settings/log_out_all_others")
|
||||||
|
|
|
@ -388,7 +388,6 @@ def create_sub2(v):
|
||||||
|
|
||||||
sub = Sub(name=name)
|
sub = Sub(name=name)
|
||||||
g.db.add(sub)
|
g.db.add(sub)
|
||||||
g.db.flush()
|
|
||||||
mod = Mod(user_id=v.id, sub=sub.name)
|
mod = Mod(user_id=v.id, sub=sub.name)
|
||||||
g.db.add(mod)
|
g.db.add(mod)
|
||||||
|
|
||||||
|
|
|
@ -111,11 +111,9 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
try: g.db.flush()
|
try: return votes.count()
|
||||||
except: abort(500)
|
except: abort(500)
|
||||||
|
|
||||||
return votes.count()
|
|
||||||
|
|
||||||
target.upvotes = get_vote_count(1, False)
|
target.upvotes = get_vote_count(1, False)
|
||||||
target.downvotes = get_vote_count(-1, False)
|
target.downvotes = get_vote_count(-1, False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue