From ab69b9b1a60a83cf2b5d6c021da0cb35540df10f Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 30 Apr 2020 19:50:47 +0200 Subject: Refactor UpdateOAuth2Application (#11034) Following on from #11008 refactor UpdateOAuth2Application --- routers/user/setting/oauth2.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'routers/user') diff --git a/routers/user/setting/oauth2.go b/routers/user/setting/oauth2.go index 265e32642b..f42c1123e1 100644 --- a/routers/user/setting/oauth2.go +++ b/routers/user/setting/oauth2.go @@ -62,7 +62,8 @@ func OAuthApplicationsEdit(ctx *context.Context, form auth.EditOAuth2Application return } // TODO validate redirect URI - if err := models.UpdateOAuth2Application(models.UpdateOAuth2ApplicationOptions{ + var err error + if ctx.Data["App"], err = models.UpdateOAuth2Application(models.UpdateOAuth2ApplicationOptions{ ID: ctx.ParamsInt64("id"), Name: form.Name, RedirectURIs: []string{form.RedirectURI}, @@ -71,11 +72,6 @@ func OAuthApplicationsEdit(ctx *context.Context, form auth.EditOAuth2Application ctx.ServerError("UpdateOAuth2Application", err) return } - var err error - if ctx.Data["App"], err = models.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")); err != nil { - ctx.ServerError("GetOAuth2ApplicationByID", err) - return - } ctx.Flash.Success(ctx.Tr("settings.update_oauth2_application_success")) ctx.HTML(200, tplSettingsOAuthApplications) } -- cgit v1.2.3