summaryrefslogtreecommitdiffstats
path: root/app/user.go
diff options
context:
space:
mode:
authorRuzette Tanyag <ruzette@users.noreply.github.com>2017-02-08 05:00:16 -0500
committerJoram Wilander <jwawilander@gmail.com>2017-02-08 02:00:16 -0800
commit0162d8ad08815b9b833fc651c7e185eab48cbbb2 (patch)
tree384c0032d766ad4a017a8a232590709134df8462 /app/user.go
parent5462f0119edb788428f90fc61c8651e4a8cd9ad1 (diff)
downloadchat-0162d8ad08815b9b833fc651c7e185eab48cbbb2.tar.gz
chat-0162d8ad08815b9b833fc651c7e185eab48cbbb2.tar.bz2
chat-0162d8ad08815b9b833fc651c7e185eab48cbbb2.zip
Implement GET `/users/username/{username}` endpoint for APIv4 (#5310)
* added get user by username endpoint * added get user by username unit test and driver * changed username length to 22 characters max * changed Params to UserName to Username * reorganized get user by username and get user by email formatting in model/client4
Diffstat (limited to 'app/user.go')
-rw-r--r--app/user.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/user.go b/app/user.go
index badcc1676..94ab89bee 100644
--- a/app/user.go
+++ b/app/user.go
@@ -323,7 +323,8 @@ func GetUser(userId string) (*model.User, *model.AppError) {
}
func GetUserByUsername(username string) (*model.User, *model.AppError) {
- if result := <-Srv.Store.User().GetByUsername(username); result.Err != nil {
+ if result := <-Srv.Store.User().GetByUsername(username); result.Err != nil && result.Err.Id == "store.sql_user.get_by_username.app_error" {
+ result.Err.StatusCode = http.StatusNotFound
return nil, result.Err
} else {
return result.Data.(*model.User), nil