From f612baacd30938f2fbac8b8dca51d58299e83ad7 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 9 Nov 2024 16:35:21 +0200 Subject: [PATCH] better user search --- files/assets/js/emoji_modal/inline_user_modal.js | 2 +- files/routes/static.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/assets/js/emoji_modal/inline_user_modal.js b/files/assets/js/emoji_modal/inline_user_modal.js index 37437a280..2a73044eb 100644 --- a/files/assets/js/emoji_modal/inline_user_modal.js +++ b/files/assets/js/emoji_modal/inline_user_modal.js @@ -105,7 +105,7 @@ function populate_inline_user_modal(results, textbox) let user_option_text = document.createElement("span"); - user_option_text.textContent = name; + user_option_text.textContent = name.split(',')[0]; user_option.addEventListener('click', () => { replaceText(textbox, `@${name} `) diff --git a/files/routes/static.py b/files/routes/static.py index 0361d0cb2..d00233c8d 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -172,7 +172,7 @@ def groups_csv(v): @limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) @auth_required def users_csv(v): - users = g.db.query(User.username) + users = g.db.query(User.username, User.original_username, User.extra_username) if SITE == 'watchpeopledie.tv': users = users.filter(User.truescore > 100) @@ -181,7 +181,7 @@ def users_csv(v): t = time.time() - 604800 users = users.filter(or_(User.truescore > 10, User.last_active > t)) - return [x[0] for x in users.order_by(User.truescore.desc()).all()] + return [f'{x[0]},{x[1]},{x[2]}' for x in users.order_by(User.truescore.desc()).all()] @app.get('/sidebar') @limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)