make user search also user original_username for searching

master
Aevann1 2022-07-30 20:29:07 +02:00
parent 71748f22c2
commit 85c4ff1621
1 changed files with 6 additions and 1 deletions

View File

@ -232,7 +232,12 @@ def searchusers(v):
term=query.lstrip('@') term=query.lstrip('@')
term = term.replace('\\','').replace('_','\_').replace('%','') term = term.replace('\\','').replace('_','\_').replace('%','')
users=g.db.query(User).filter(User.username.ilike(f'%{term}%')) users=g.db.query(User).filter(
or_(
User.username.ilike(f'%{term}%'),
User.original_username.ilike(f'%{term}%')
)
)
users=users.order_by(User.username.ilike(term).desc(), User.stored_subscriber_count.desc()) users=users.order_by(User.username.ilike(term).desc(), User.stored_subscriber_count.desc())