partially revert a94dda90dd. restore some commits that turned out to be necessary

master
Aevann 2023-07-26 00:42:47 +03:00
parent a57ff00e09
commit 2f8fec6fff
4 changed files with 6 additions and 1 deletions

View File

@ -118,6 +118,7 @@ def _sub_inactive_purge_task():
for x in to_delete:
g.db.delete(x)
g.db.flush() #Necessary, following deletion errors out otherwise
for x in dead_holes:
g.db.delete(x)

View File

@ -321,6 +321,8 @@ def sign_up_post(v:Optional[User]):
g.db.add(new_user)
g.db.flush()
if ref_id:
ref_user = get_account(ref_id)

View File

@ -52,6 +52,7 @@ def add_alt(user1:int, user2:int):
if not existing:
new_alt = Alt(user1=user1, user2=user2)
g.db.add(new_alt)
g.db.flush()
cache.delete_memoized(get_alt_graph_ids, user1)
cache.delete_memoized(get_alt_graph_ids, user2)
@ -79,7 +80,7 @@ def check_for_alts(current:User, include_current_session=False):
past_accs.add(current_id)
if include_current_session:
session["history"] = list(past_accs)
g.db.flush()
for u in get_alt_graph(current.id):
if u.shadowbanned and not current.shadowbanned:
current.shadowbanned = u.shadowbanned

View File

@ -388,6 +388,7 @@ def create_sub2(v):
sub = Sub(name=name)
g.db.add(sub)
g.db.flush() #Necessary, following statement errors out otherwise
mod = Mod(user_id=v.id, sub=sub.name)
g.db.add(mod)