forked from rDrama/rDrama
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.add(new_alt)
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
check_for_alts(g.db.get(User, u1))
|
check_for_alts(g.db.get(User, u1), include_current_session=False)
|
||||||
check_for_alts(g.db.get(User, u2))
|
check_for_alts(g.db.get(User, u2), include_current_session=False)
|
||||||
|
|
||||||
ma = ModAction(
|
ma = ModAction(
|
||||||
kind="link_accounts",
|
kind="link_accounts",
|
||||||
|
|
|
@ -21,13 +21,13 @@ def login_get(v):
|
||||||
return render_template("login.html", failed=False, redirect=redir)
|
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
|
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"] = []
|
session["history"] = []
|
||||||
return
|
return
|
||||||
ids = [x[0] for x in g.db.query(User.id).all()]
|
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):
|
def add_alt(user1:int, user2:int):
|
||||||
li = [user1, user2]
|
li = [user1, user2]
|
||||||
|
@ -59,6 +59,7 @@ def check_for_alts(current:User):
|
||||||
add_alt(a.user2, current_id)
|
add_alt(a.user2, current_id)
|
||||||
|
|
||||||
past_accs.add(current_id)
|
past_accs.add(current_id)
|
||||||
|
if include_current_session:
|
||||||
session["history"] = list(past_accs)
|
session["history"] = list(past_accs)
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
for u in current.alts_unique:
|
for u in current.alts_unique:
|
||||||
|
|
Loading…
Reference in New Issue