dont use g.db.execute

remotes/1693045480750635534/spooky-22
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
@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