diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-03-23 06:34:22 -0400 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-03-23 10:34:22 +0000 |
commit | 2a753949f10f70de26dba9fbff7c5ef9583d6c86 (patch) | |
tree | 4430844f254e62afdcf7b0e61da5870f2c8f7061 /api/user.go | |
parent | 7e2e8238842c7d158211faafe03f814bffa78a8f (diff) | |
download | chat-2a753949f10f70de26dba9fbff7c5ef9583d6c86.tar.gz chat-2a753949f10f70de26dba9fbff7c5ef9583d6c86.tar.bz2 chat-2a753949f10f70de26dba9fbff7c5ef9583d6c86.zip |
Implement POST /users/search endpoint for APIv4 (#5822)
* Implement POST /users/search endpoint for APIv4
* PLT-2713 Added store functions for searching users that don't have a team
* PLT-2713 Added 'without_team' option when searching users
* PLT-2713 Added 'without_team' option when searching users (v4)
Diffstat (limited to 'api/user.go')
-rw-r--r-- | api/user.go | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/api/user.go b/api/user.go index 24a9025e4..795e83a2a 100644 --- a/api/user.go +++ b/api/user.go @@ -1535,22 +1535,12 @@ func searchUsers(c *Context, w http.ResponseWriter, r *http.Request) { } } - var profiles []*model.User - var err *model.AppError - if props.InChannelId != "" { - profiles, err = app.SearchUsersInChannel(props.InChannelId, props.Term, searchOptions, c.IsSystemAdmin()) - } else if props.NotInChannelId != "" { - profiles, err = app.SearchUsersNotInChannel(props.TeamId, props.NotInChannelId, props.Term, searchOptions, c.IsSystemAdmin()) - } else { - profiles, err = app.SearchUsersInTeam(props.TeamId, props.Term, searchOptions, c.IsSystemAdmin()) - } - - if err != nil { + if profiles, err := app.SearchUsers(props, searchOptions, c.IsSystemAdmin()); err != nil { c.Err = err return + } else { + w.Write([]byte(model.UserListToJson(profiles))) } - - w.Write([]byte(model.UserListToJson(profiles))) } func getProfilesByIds(c *Context, w http.ResponseWriter, r *http.Request) { |