make mentioning case-insensitive again

master
Aevann1 2022-06-18 00:03:23 +02:00
parent 50135ce159
commit c01d53aa0d
2 changed files with 3 additions and 3 deletions

View File

@ -75,8 +75,8 @@ def get_users(usernames, v=None, graceful=False):
users = g.db.query(User).filter( users = g.db.query(User).filter(
or_( or_(
User.username == any_(usernames), User.username.ilike(any_(usernames)),
User.original_username == any_(usernames) User.original_username.ilike(any_(usernames))
) )
).all() ).all()

View File

@ -201,7 +201,7 @@ def sanitize(sanitized, alert=False, edit=False):
for u in users: for u in users:
if not u: continue if not u: continue
m = [ m for m in matches if u.username == m.group(2) or u.original_username == m.group(2) ] m = [ m for m in matches if u.username.lower() == m.group(2).lower() or u.original_username.lower() == m.group(2).lower() ]
for i in m: for i in m:
if not (g.v and g.v.any_block_exists(u)) or g.v.admin_level > 1: if not (g.v and g.v.any_block_exists(u)) or g.v.admin_level > 1:
sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}<a href="/id/{u.id}"><img loading="lazy" src="/pp/{u.id}">@{u.username}</a>''', 1) sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}<a href="/id/{u.id}"><img loading="lazy" src="/pp/{u.id}">@{u.username}</a>''', 1)