Make sure robot accounts always show up first in entity search
Fixes https://www.pivotaltracker.com/story/show/136277321 Fixes #2241
This commit is contained in:
parent
f72185f527
commit
58b7481a63
1 changed files with 3 additions and 2 deletions
|
@ -579,7 +579,7 @@ def get_matching_users(username_prefix, robot_namespace=None, organization=None,
|
|||
if robot_namespace:
|
||||
robot_prefix = format_robot_username(robot_namespace, username_prefix)
|
||||
robot_search = _basequery.prefix_search(User.username, robot_prefix)
|
||||
direct_user_query = (direct_user_query | (robot_search & (User.robot == True)))
|
||||
direct_user_query = ((robot_search & (User.robot == True)) | direct_user_query)
|
||||
|
||||
query = (User
|
||||
.select(User.id, User.username, User.email, User.robot)
|
||||
|
@ -591,7 +591,8 @@ def get_matching_users(username_prefix, robot_namespace=None, organization=None,
|
|||
.select(User.id, User.username, User.email, User.robot, fn.Sum(Team.id))
|
||||
.join(TeamMember, JOIN_LEFT_OUTER)
|
||||
.join(Team, JOIN_LEFT_OUTER, on=((Team.id == TeamMember.team) &
|
||||
(Team.organization == organization))))
|
||||
(Team.organization == organization)))
|
||||
.order_by(User.robot.desc()))
|
||||
|
||||
class MatchingUserResult(object):
|
||||
def __init__(self, *args):
|
||||
|
|
Reference in a new issue