From 85c4ff1621106de76813a311fc1e33bea4157f43 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 30 Jul 2022 20:29:07 +0200 Subject: [PATCH] make user search also user original_username for searching --- files/routes/search.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/files/routes/search.py b/files/routes/search.py index ca54b7827..f33caa8a1 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -232,7 +232,12 @@ def searchusers(v): term=query.lstrip('@') 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())