From 2478b874320ed91d4424dea42a40aacbd2b1ce1c Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sat, 3 Jun 2017 07:26:09 -0400 Subject: Refactoring: rename ctx -> c --- routers/api/v1/user/app.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'routers/api/v1/user/app.go') diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go index ebba7f09..bda1e23f 100644 --- a/routers/api/v1/user/app.go +++ b/routers/api/v1/user/app.go @@ -12,10 +12,10 @@ import ( ) // https://github.com/gogits/go-gogs-client/wiki/Users#list-access-tokens-for-a-user -func ListAccessTokens(ctx *context.APIContext) { - tokens, err := models.ListAccessTokens(ctx.User.ID) +func ListAccessTokens(c *context.APIContext) { + tokens, err := models.ListAccessTokens(c.User.ID) if err != nil { - ctx.Error(500, "ListAccessTokens", err) + c.Error(500, "ListAccessTokens", err) return } @@ -23,18 +23,18 @@ func ListAccessTokens(ctx *context.APIContext) { for i := range tokens { apiTokens[i] = &api.AccessToken{tokens[i].Name, tokens[i].Sha1} } - ctx.JSON(200, &apiTokens) + c.JSON(200, &apiTokens) } // https://github.com/gogits/go-gogs-client/wiki/Users#create-a-access-token -func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) { +func CreateAccessToken(c *context.APIContext, form api.CreateAccessTokenOption) { t := &models.AccessToken{ - UID: ctx.User.ID, + UID: c.User.ID, Name: form.Name, } if err := models.NewAccessToken(t); err != nil { - ctx.Error(500, "NewAccessToken", err) + c.Error(500, "NewAccessToken", err) return } - ctx.JSON(201, &api.AccessToken{t.Name, t.Sha1}) + c.JSON(201, &api.AccessToken{t.Name, t.Sha1}) } -- cgit v1.2.3