From fd7d83ace60258acf7139c4c787aa8af75b7ba8c Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 20 May 2022 22:08:52 +0800 Subject: Move almost all functions' parameter db.Engine to context.Context (#19748) * Move almost all functions' parameter db.Engine to context.Context * remove some unnecessary wrap functions --- routers/web/user/setting/oauth2.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'routers/web/user/setting/oauth2.go') diff --git a/routers/web/user/setting/oauth2.go b/routers/web/user/setting/oauth2.go index 76c50852a0..db76a12f18 100644 --- a/routers/web/user/setting/oauth2.go +++ b/routers/web/user/setting/oauth2.go @@ -34,7 +34,7 @@ func OAuthApplicationsPost(ctx *context.Context) { return } // TODO validate redirect URI - app, err := auth.CreateOAuth2Application(auth.CreateOAuth2ApplicationOptions{ + app, err := auth.CreateOAuth2Application(ctx, auth.CreateOAuth2ApplicationOptions{ Name: form.Name, RedirectURIs: []string{form.RedirectURI}, UserID: ctx.Doer.ID, @@ -85,7 +85,7 @@ func OAuthApplicationsRegenerateSecret(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsApplications"] = true - app, err := auth.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")) + app, err := auth.GetOAuth2ApplicationByID(ctx, ctx.ParamsInt64("id")) if err != nil { if auth.IsErrOAuthApplicationNotFound(err) { ctx.NotFound("Application not found", err) @@ -110,7 +110,7 @@ func OAuthApplicationsRegenerateSecret(ctx *context.Context) { // OAuth2ApplicationShow displays the given application func OAuth2ApplicationShow(ctx *context.Context) { - app, err := auth.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")) + app, err := auth.GetOAuth2ApplicationByID(ctx, ctx.ParamsInt64("id")) if err != nil { if auth.IsErrOAuthApplicationNotFound(err) { ctx.NotFound("Application not found", err) @@ -147,7 +147,7 @@ func RevokeOAuth2Grant(ctx *context.Context) { ctx.ServerError("RevokeOAuth2Grant", fmt.Errorf("user id or grant id is zero")) return } - if err := auth.RevokeOAuth2Grant(ctx.FormInt64("id"), ctx.Doer.ID); err != nil { + if err := auth.RevokeOAuth2Grant(ctx, ctx.FormInt64("id"), ctx.Doer.ID); err != nil { ctx.ServerError("RevokeOAuth2Grant", err) return } -- cgit v1.2.3