dont use g.db.execute

master
Aevann1 2022-09-05 09:37:20 +02:00
parent 22c65f74da
commit 8fb22a397c
1 changed files with 3 additions and 12 deletions

View File

@ -768,18 +768,9 @@ class User(Base):
@property @property
@lazy @lazy
def has_shadowbanned_alts(self): def has_shadowbanned_alts(self):
qty = g.db.execute( for u in alts_unique:
"""SELECT COUNT(*) FROM ( if u.shadowbanned or u.is_suspended_permanently: return True
SELECT (CASE return False
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
@property @property
@lazy @lazy