mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-01 04:12:10 +00:00
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
This commit is contained in:
parent
2eeae4edb6
commit
c4d70a0325
64 changed files with 236 additions and 449 deletions
|
@ -143,7 +143,7 @@ func Profile(ctx *context.Context) {
|
|||
ctx.Data["Orgs"] = orgs
|
||||
ctx.Data["HasOrgsVisible"] = models.HasOrgsVisible(orgs, ctx.User)
|
||||
|
||||
tab := ctx.Form("tab")
|
||||
tab := ctx.FormString("tab")
|
||||
ctx.Data["TabName"] = tab
|
||||
|
||||
page := ctx.FormInt("page")
|
||||
|
@ -160,8 +160,8 @@ func Profile(ctx *context.Context) {
|
|||
orderBy models.SearchOrderBy
|
||||
)
|
||||
|
||||
ctx.Data["SortType"] = ctx.Form("sort")
|
||||
switch ctx.Form("sort") {
|
||||
ctx.Data["SortType"] = ctx.FormString("sort")
|
||||
switch ctx.FormString("sort") {
|
||||
case "newest":
|
||||
orderBy = models.SearchOrderByNewest
|
||||
case "oldest":
|
||||
|
@ -187,7 +187,7 @@ func Profile(ctx *context.Context) {
|
|||
orderBy = models.SearchOrderByRecentUpdated
|
||||
}
|
||||
|
||||
keyword := strings.Trim(ctx.Form("q"), " ")
|
||||
keyword := strings.Trim(ctx.FormString("q"), " ")
|
||||
ctx.Data["Keyword"] = keyword
|
||||
switch tab {
|
||||
case "followers":
|
||||
|
@ -220,7 +220,7 @@ func Profile(ctx *context.Context) {
|
|||
IncludePrivate: showPrivate,
|
||||
OnlyPerformedBy: true,
|
||||
IncludeDeleted: false,
|
||||
Date: ctx.Form("date"),
|
||||
Date: ctx.FormString("date"),
|
||||
})
|
||||
if ctx.Written() {
|
||||
return
|
||||
|
@ -332,5 +332,5 @@ func Action(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
ctx.RedirectToFirst(ctx.Form("redirect_to"), u.HomeLink())
|
||||
ctx.RedirectToFirst(ctx.FormString("redirect_to"), u.HomeLink())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue