From f81d4b0c37cadefa13a8c5bc7c53d0bfe794511b Mon Sep 17 00:00:00 2001 From: lian Date: Thu, 21 Jul 2022 16:26:37 +0800 Subject: [PATCH] specific search `q` if `q` exists, put it in the front of search result --- seahub/api2/endpoints/search_user.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/seahub/api2/endpoints/search_user.py b/seahub/api2/endpoints/search_user.py index b904617cb4..e1c1c70c48 100644 --- a/seahub/api2/endpoints/search_user.py +++ b/seahub/api2/endpoints/search_user.py @@ -160,6 +160,13 @@ class SearchUser(APIView): except ValueError: size = 32 + # specific search `q` + user_q_obj = ccnet_api.get_emailuser(q) + if user_q_obj and user_q_obj.is_active: + if q in email_result: + email_result.remove(q) + email_result.insert(0, q) + formated_result = format_searched_user_result( request, email_result[:10], size)