From 8fb22a397c6d1b25a600a37a7e885d7905fe5b89 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 5 Sep 2022 09:37:20 +0200 Subject: [PATCH] dont use g.db.execute --- files/classes/user.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 382ec8fd7..560e48ecf 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -768,18 +768,9 @@ class User(Base): @property @lazy def has_shadowbanned_alts(self): - qty = g.db.execute( - """SELECT COUNT(*) FROM ( - SELECT (CASE - WHEN user1 = :u THEN user2 - WHEN user2 = :u THEN user1 - END) AS id FROM alts - WHERE user1 = :u OR user2 = :u - ) AS a - JOIN users ON a.id = users.id - WHERE users.shadowbanned IS NOT NULL or users.is_banned != 0 and users.unban_utc = 0""", - {"u": self.id}).scalar() - return qty > 0 + for u in alts_unique: + if u.shadowbanned or u.is_suspended_permanently: return True + return False @property @lazy