From 6da0ccd94447ddc5bcf51285ebac411dd3188cce Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Thu, 3 Nov 2016 11:24:45 -0400 Subject: Update user search to match against username, full name, nickname and email (#4421) --- api/user.go | 4 +++- api/user_test.go | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'api') diff --git a/api/user.go b/api/user.go index 787039355..e0507f399 100644 --- a/api/user.go +++ b/api/user.go @@ -2615,7 +2615,6 @@ func searchUsers(c *Context, w http.ResponseWriter, r *http.Request) { } searchOptions := map[string]bool{} - searchOptions[store.USER_SEARCH_OPTION_USERNAME_ONLY] = true searchOptions[store.USER_SEARCH_OPTION_ALLOW_INACTIVE] = props.AllowInactive var uchan store.StoreChannel @@ -2680,6 +2679,9 @@ func autocompleteUsersInChannel(c *Context, w http.ResponseWriter, r *http.Reque return } + searchOptions := map[string]bool{} + searchOptions[store.USER_SEARCH_OPTION_NAMES_ONLY] = true + uchan := Srv.Store.User().SearchInChannel(channelId, term, map[string]bool{}) nuchan := Srv.Store.User().SearchNotInChannel(teamId, channelId, term, map[string]bool{}) diff --git a/api/user_test.go b/api/user_test.go index 5f7cc375d..1ffb2140c 100644 --- a/api/user_test.go +++ b/api/user_test.go @@ -2205,7 +2205,6 @@ func TestSearchUsers(t *testing.T) { } if _, err := Client.SearchUsers(model.UserSearch{Term: th.BasicUser.Username, NotInChannelId: th.BasicChannel.Id}); err == nil { - t.Fatal("should not have access") } } -- cgit v1.2.3-1-g7c22