forked from MarseyWorld/MarseyWorld
alts: only change session data if new include_current_session flag is set
parent
1bf3d3abc3
commit
7d80483f67
|
@ -744,8 +744,8 @@ def admin_link_accounts(v):
|
|||
g.db.add(new_alt)
|
||||
g.db.flush()
|
||||
|
||||
check_for_alts(g.db.get(User, u1))
|
||||
check_for_alts(g.db.get(User, u2))
|
||||
check_for_alts(g.db.get(User, u1), include_current_session=False)
|
||||
check_for_alts(g.db.get(User, u2), include_current_session=False)
|
||||
|
||||
ma = ModAction(
|
||||
kind="link_accounts",
|
||||
|
|
|
@ -21,13 +21,13 @@ def login_get(v):
|
|||
return render_template("login.html", failed=False, redirect=redir)
|
||||
|
||||
|
||||
def check_for_alts(current:User):
|
||||
def check_for_alts(current:User, include_current_session=True):
|
||||
current_id = current.id
|
||||
if current_id in (1691,6790,7069,36152):
|
||||
if current_id in (1691,6790,7069,36152) and include_current_session:
|
||||
session["history"] = []
|
||||
return
|
||||
ids = [x[0] for x in g.db.query(User.id).all()]
|
||||
past_accs = set(session.get("history", []))
|
||||
past_accs = set(session.get("history", [])) if include_current_session else set()
|
||||
|
||||
def add_alt(user1:int, user2:int):
|
||||
li = [user1, user2]
|
||||
|
@ -59,6 +59,7 @@ def check_for_alts(current:User):
|
|||
add_alt(a.user2, current_id)
|
||||
|
||||
past_accs.add(current_id)
|
||||
if include_current_session:
|
||||
session["history"] = list(past_accs)
|
||||
g.db.flush()
|
||||
for u in current.alts_unique:
|
||||
|
|
Loading…
Reference in New Issue