PLT-4697 Update channel switcher to autocomplete all users on the system (#4624)

* Add autocomplete API for system-wide users

* Update channel switcher to autocomplete all users on the system
Этот коммит содержится в:
Joram Wilander
2016-11-29 10:12:59 -05:00
коммит произвёл Christopher Speller
родитель ad52183248
Коммит 02d581c159
7 изменённых файлов: 119 добавлений и 5 удалений

Просмотреть файл

@@ -621,6 +621,19 @@ func (c *Client) AutocompleteUsersInTeam(term string) (*Result, *AppError) {
}
}
// AutocompleteUsers returns a list for autocompletion of users on the system that match the provided term,
// matching against username, full name and nickname. Must be authenticated.
func (c *Client) AutocompleteUsers(term string) (*Result, *AppError) {
url := fmt.Sprintf("/users/autocomplete?term=%s", url.QueryEscape(term))
if r, err := c.DoApiGet(url, "", ""); err != nil {
return nil, err
} else {
defer closeBody(r)
return &Result{r.Header.Get(HEADER_REQUEST_ID),
r.Header.Get(HEADER_ETAG_SERVER), UserListFromJson(r.Body)}, nil
}
}
// LoginById authenticates a user by user id and password.
func (c *Client) LoginById(id string, password string) (*Result, *AppError) {
m := make(map[string]string)