forked from rDrama/rDrama
fix muting linking alts
parent
9866e7ed95
commit
b23dc76d78
|
@ -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, user1.id)
|
||||||
cache.delete_memoized(get_alt_graph_ids, user2.id)
|
cache.delete_memoized(get_alt_graph_ids, user2.id)
|
||||||
|
|
||||||
check_for_alts(user1, include_current_session=False)
|
check_for_alts(user1)
|
||||||
check_for_alts(user2, include_current_session=False)
|
check_for_alts(user2)
|
||||||
|
|
||||||
word = 'Delinked' if deleted else 'Linked'
|
word = 'Delinked' if deleted else 'Linked'
|
||||||
ma_word = 'delink' if deleted else 'link'
|
ma_word = 'delink' if deleted else 'link'
|
||||||
|
@ -672,8 +672,8 @@ def admin_delink_relink_alt(v:User, username, other):
|
||||||
a.deleted = is_delinking
|
a.deleted = is_delinking
|
||||||
g.db.add(a)
|
g.db.add(a)
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
check_for_alts(user1, include_current_session=False)
|
check_for_alts(user1)
|
||||||
check_for_alts(user2, include_current_session=False)
|
check_for_alts(user2)
|
||||||
word = 'Delinked' if is_delinking else 'Relinked'
|
word = 'Delinked' if is_delinking else 'Relinked'
|
||||||
ma_word = 'delink' if is_delinking else 'link'
|
ma_word = 'delink' if is_delinking else 'link'
|
||||||
note = f'from @{user2.username}' if is_delinking else f'with @{user2.username} (relinked)'
|
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)
|
reason = filter_emojis_only(reason)
|
||||||
user.ban_reason = reason
|
user.ban_reason = reason
|
||||||
g.db.add(user)
|
g.db.add(user)
|
||||||
check_for_alts(user, False)
|
check_for_alts(user)
|
||||||
|
|
||||||
ma = ModAction(
|
ma = ModAction(
|
||||||
kind="shadowban",
|
kind="shadowban",
|
||||||
|
|
|
@ -122,7 +122,7 @@ def on_login(account, redir=None):
|
||||||
session.permanent = True
|
session.permanent = True
|
||||||
session["lo_user"] = account.id
|
session["lo_user"] = account.id
|
||||||
session["login_nonce"] = account.login_nonce
|
session["login_nonce"] = account.login_nonce
|
||||||
check_for_alts(account)
|
check_for_alts(account, include_current_session=True)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/me")
|
@app.get("/me")
|
||||||
|
@ -343,7 +343,7 @@ def sign_up_post(v:Optional[User]):
|
||||||
session.permanent = True
|
session.permanent = True
|
||||||
session["lo_user"] = new_user.id
|
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)
|
send_notification(new_user.id, WELCOME_MSG)
|
||||||
|
|
||||||
if SIGNUP_FOLLOW_ID:
|
if SIGNUP_FOLLOW_ID:
|
||||||
|
|
|
@ -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, user1)
|
||||||
cache.delete_memoized(get_alt_graph_ids, user2)
|
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
|
current_id = current.id
|
||||||
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", [])) if include_current_session else set()
|
past_accs = set(session.get("history", [])) if include_current_session else set()
|
||||||
|
|
|
@ -1226,7 +1226,7 @@ def fp(v:User, fp):
|
||||||
add_alt(user1=v.id, user2=u.id)
|
add_alt(user1=v.id, user2=u.id)
|
||||||
print(v.username + ' + ' + u.username, flush=True)
|
print(v.username + ' + ' + u.username, flush=True)
|
||||||
|
|
||||||
check_for_alts(v)
|
check_for_alts(v, include_current_session=True)
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
return '', 204
|
return '', 204
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue