diff options
author | 6543 <6543@obermui.de> | 2021-08-11 02:31:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-11 02:31:13 +0200 |
commit | c4d70a032564f610b7215d3d3973943abbc7395f (patch) | |
tree | 2aa8fe44a1b4d0251a18ae671509d4f2439ed85d /routers/web/repo/setting.go | |
parent | 2eeae4edb685b22e926d301465d771fe7a0b0c83 (diff) | |
download | gitea-c4d70a032564f610b7215d3d3973943abbc7395f.tar.gz gitea-c4d70a032564f610b7215d3d3973943abbc7395f.zip |
Rename ctx.Form() to ctx.FormString() and move code into own file (#16571)
Followup from #16562 prepare for #16567
* Rename ctx.Form() to ctx.FormString()
* Reimplement FormX func to need less code and cpu cycles
* Move code into own file
Diffstat (limited to 'routers/web/repo/setting.go')
-rw-r--r-- | routers/web/repo/setting.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/routers/web/repo/setting.go b/routers/web/repo/setting.go index c1c49e8ac6..2f15610737 100644 --- a/routers/web/repo/setting.go +++ b/routers/web/repo/setting.go @@ -70,7 +70,7 @@ func SettingsPost(ctx *context.Context) { repo := ctx.Repo.Repository - switch ctx.Form("action") { + switch ctx.FormString("action") { case "update": if ctx.HasError() { ctx.HTML(http.StatusOK, tplSettingsOptions) @@ -560,7 +560,7 @@ func SettingsPost(ctx *context.Context) { return } - newOwner, err := models.GetUserByName(ctx.Form("new_owner_name")) + newOwner, err := models.GetUserByName(ctx.FormString("new_owner_name")) if err != nil { if models.IsErrUserNotExist(err) { ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_owner_name"), tplSettingsOptions, nil) @@ -775,7 +775,7 @@ func Collaboration(ctx *context.Context) { // CollaborationPost response for actions for a collaboration of a repository func CollaborationPost(ctx *context.Context) { - name := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.Form("collaborator"))) + name := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.FormString("collaborator"))) if len(name) == 0 || ctx.Repo.Owner.LowerName == name { ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path) return @@ -854,7 +854,7 @@ func AddTeamPost(ctx *context.Context) { return } - name := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.Form("team"))) + name := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.FormString("team"))) if len(name) == 0 { ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") return @@ -988,7 +988,7 @@ func GitHooksEditPost(ctx *context.Context) { } return } - hook.Content = ctx.Form("content") + hook.Content = ctx.FormString("content") if err = hook.Update(); err != nil { ctx.ServerError("hook.Update", err) return |