Skip to content

Commit

Permalink
changed Params to UserName to Username
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzette committed Feb 7, 2017
1 parent 20e43a2 commit 679cb10
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions api4/context.go
Expand Up @@ -359,16 +359,16 @@ func (c *Context) RequireChannelId() *Context {
return c
}

func (c *Context) RequireUserName() *Context {
func (c *Context) RequireUsername() *Context {
if c.Err != nil {
return c
}

if len(c.Params.UserName) < 3 {
if len(c.Params.Username) < 3 {
c.SetInvalidUrlParam("username")
}

if len(c.Params.UserName) > 22 {
if len(c.Params.Username) > 22 {
c.SetInvalidUrlParam("username")
}

Expand Down
4 changes: 2 additions & 2 deletions api4/params.go
Expand Up @@ -25,7 +25,7 @@ type ApiParams struct {
CommandId string
HookId string
EmojiId string
UserName string
Username string
Page int
PerPage int
}
Expand Down Expand Up @@ -68,7 +68,7 @@ func ApiParamsFromRequest(r *http.Request) *ApiParams {
}

if val, ok := props["username"]; ok {
params.UserName = val
params.Username = val
}

if val, err := strconv.Atoi(r.URL.Query().Get("page")); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions api4/user.go
Expand Up @@ -90,7 +90,7 @@ func getUser(c *Context, w http.ResponseWriter, r *http.Request) {
}

func getUserByUsername(c *Context, w http.ResponseWriter, r *http.Request) {
c.RequireUserName()
c.RequireUsername()
if c.Err != nil {
return
}
Expand All @@ -100,7 +100,7 @@ func getUserByUsername(c *Context, w http.ResponseWriter, r *http.Request) {
var user *model.User
var err *model.AppError

if user, err = app.GetUserByUsername(c.Params.UserName); err != nil {
if user, err = app.GetUserByUsername(c.Params.Username); err != nil {
c.Err = err
return
}
Expand Down

0 comments on commit 679cb10

Please sign in to comment.