Merge pull request #2243 from coreos-inc/entity-autocomplete
Make sure robot accounts always show up first in entity search
This commit is contained in:
commit
d4b7738a87
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:
|
if robot_namespace:
|
||||||
robot_prefix = format_robot_username(robot_namespace, username_prefix)
|
robot_prefix = format_robot_username(robot_namespace, username_prefix)
|
||||||
robot_search = _basequery.prefix_search(User.username, robot_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
|
query = (User
|
||||||
.select(User.id, User.username, User.email, User.robot)
|
.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))
|
.select(User.id, User.username, User.email, User.robot, fn.Sum(Team.id))
|
||||||
.join(TeamMember, JOIN_LEFT_OUTER)
|
.join(TeamMember, JOIN_LEFT_OUTER)
|
||||||
.join(Team, JOIN_LEFT_OUTER, on=((Team.id == TeamMember.team) &
|
.join(Team, JOIN_LEFT_OUTER, on=((Team.id == TeamMember.team) &
|
||||||
(Team.organization == organization))))
|
(Team.organization == organization)))
|
||||||
|
.order_by(User.robot.desc()))
|
||||||
|
|
||||||
class MatchingUserResult(object):
|
class MatchingUserResult(object):
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
|
|
Reference in a new issue