diff options
Diffstat (limited to 'routers/api/v1/user/user.go')
-rw-r--r-- | routers/api/v1/user/user.go | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index b860219e62..ecc149fe52 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -107,13 +107,8 @@ func GetInfo(ctx *context.APIContext) { // "404": // "$ref": "#/responses/notFound" - u, err := models.GetUserByName(ctx.Params(":username")) - if err != nil { - if models.IsErrUserNotExist(err) { - ctx.NotFound() - } else { - ctx.Error(http.StatusInternalServerError, "GetUserByName", err) - } + u := GetUserByParams(ctx) + if ctx.Written() { return } @@ -153,14 +148,8 @@ func GetUserHeatmapData(ctx *context.APIContext) { // "404": // "$ref": "#/responses/notFound" - // Get the user to throw an error if it does not exist - user, err := models.GetUserByName(ctx.Params(":username")) - if err != nil { - if models.IsErrUserNotExist(err) { - ctx.Status(http.StatusNotFound) - } else { - ctx.Error(http.StatusInternalServerError, "GetUserByName", err) - } + user := GetUserByParams(ctx) + if ctx.Written() { return } |