fix muting linking alts

pull/98/head
Aevann 2023-01-25 04:53:52 +02:00
parent 9866e7ed95
commit b23dc76d78
4 changed files with 9 additions and 9 deletions

View File

@ -643,8 +643,8 @@ def admin_add_alt(v:User, username):
cache.delete_memoized(get_alt_graph_ids, user1.id)
cache.delete_memoized(get_alt_graph_ids, user2.id)
check_for_alts(user1, include_current_session=False)
check_for_alts(user2, include_current_session=False)
check_for_alts(user1)
check_for_alts(user2)
word = 'Delinked' if deleted else 'Linked'
ma_word = 'delink' if deleted else 'link'
@ -672,8 +672,8 @@ def admin_delink_relink_alt(v:User, username, other):
a.deleted = is_delinking
g.db.add(a)
g.db.flush()
check_for_alts(user1, include_current_session=False)
check_for_alts(user2, include_current_session=False)
check_for_alts(user1)
check_for_alts(user2)
word = 'Delinked' if is_delinking else 'Relinked'
ma_word = 'delink' if is_delinking else 'link'
note = f'from @{user2.username}' if is_delinking else f'with @{user2.username} (relinked)'
@ -785,7 +785,7 @@ def shadowban(user_id, v):
reason = filter_emojis_only(reason)
user.ban_reason = reason
g.db.add(user)
check_for_alts(user, False)
check_for_alts(user)
ma = ModAction(
kind="shadowban",

View File

@ -122,7 +122,7 @@ def on_login(account, redir=None):
session.permanent = True
session["lo_user"] = account.id
session["login_nonce"] = account.login_nonce
check_for_alts(account)
check_for_alts(account, include_current_session=True)
@app.get("/me")
@ -343,7 +343,7 @@ def sign_up_post(v:Optional[User]):
session.permanent = True
session["lo_user"] = new_user.id
check_for_alts(new_user)
check_for_alts(new_user, include_current_session=True)
send_notification(new_user.id, WELCOME_MSG)
if SIGNUP_FOLLOW_ID:

View File

@ -54,7 +54,7 @@ def add_alt(user1:int, user2:int):
cache.delete_memoized(get_alt_graph_ids, user1)
cache.delete_memoized(get_alt_graph_ids, user2)
def check_for_alts(current:User, include_current_session=True):
def check_for_alts(current:User, include_current_session=False):
current_id = current.id
ids = [x[0] for x in g.db.query(User.id).all()]
past_accs = set(session.get("history", [])) if include_current_session else set()

View File

@ -1226,7 +1226,7 @@ def fp(v:User, fp):
add_alt(user1=v.id, user2=u.id)
print(v.username + ' + ' + u.username, flush=True)
check_for_alts(v)
check_for_alts(v, include_current_session=True)
g.db.add(v)
return '', 204