diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-07-29 09:42:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 03:42:15 +0200 |
commit | 33e0b38287fdc3487112062300b8dd3c95415ee7 (patch) | |
tree | 603394d8f303de1031c21da0d3d3a3cdc0b2bfda /routers/web/explore | |
parent | 370516883717de0e6e2087c12d368eb1465ee3b0 (diff) | |
download | gitea-33e0b38287fdc3487112062300b8dd3c95415ee7.tar.gz gitea-33e0b38287fdc3487112062300b8dd3c95415ee7.zip |
Rename context.Query to context.Form (#16562)
Diffstat (limited to 'routers/web/explore')
-rw-r--r-- | routers/web/explore/code.go | 8 | ||||
-rw-r--r-- | routers/web/explore/repo.go | 10 | ||||
-rw-r--r-- | routers/web/explore/user.go | 8 |
3 files changed, 13 insertions, 13 deletions
diff --git a/routers/web/explore/code.go b/routers/web/explore/code.go index bf15b93cff..5dd8298b2d 100644 --- a/routers/web/explore/code.go +++ b/routers/web/explore/code.go @@ -33,14 +33,14 @@ func Code(ctx *context.Context) { ctx.Data["PageIsExplore"] = true ctx.Data["PageIsExploreCode"] = true - language := strings.TrimSpace(ctx.Query("l")) - keyword := strings.TrimSpace(ctx.Query("q")) - page := ctx.QueryInt("page") + language := strings.TrimSpace(ctx.Form("l")) + keyword := strings.TrimSpace(ctx.Form("q")) + page := ctx.FormInt("page") if page <= 0 { page = 1 } - queryType := strings.TrimSpace(ctx.Query("t")) + queryType := strings.TrimSpace(ctx.Form("t")) isMatch := queryType == "match" var ( diff --git a/routers/web/explore/repo.go b/routers/web/explore/repo.go index e9efae5688..faac639caa 100644 --- a/routers/web/explore/repo.go +++ b/routers/web/explore/repo.go @@ -30,7 +30,7 @@ type RepoSearchOptions struct { // RenderRepoSearch render repositories search page func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { - page := ctx.QueryInt("page") + page := ctx.FormInt("page") if page <= 0 { page = 1 } @@ -42,8 +42,8 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { orderBy models.SearchOrderBy ) - ctx.Data["SortType"] = ctx.Query("sort") - switch ctx.Query("sort") { + ctx.Data["SortType"] = ctx.Form("sort") + switch ctx.Form("sort") { case "newest": orderBy = models.SearchOrderByNewest case "oldest": @@ -73,8 +73,8 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { orderBy = models.SearchOrderByRecentUpdated } - keyword := strings.Trim(ctx.Query("q"), " ") - topicOnly := ctx.QueryBool("topic") + keyword := strings.Trim(ctx.Form("q"), " ") + topicOnly := ctx.FormBool("topic") ctx.Data["TopicOnly"] = topicOnly repos, count, err = models.SearchRepository(&models.SearchRepoOptions{ diff --git a/routers/web/explore/user.go b/routers/web/explore/user.go index 52f543fe66..85c45c7eff 100644 --- a/routers/web/explore/user.go +++ b/routers/web/explore/user.go @@ -32,7 +32,7 @@ func isKeywordValid(keyword string) bool { // RenderUserSearch render user search page func RenderUserSearch(ctx *context.Context, opts *models.SearchUserOptions, tplName base.TplName) { - opts.Page = ctx.QueryInt("page") + opts.Page = ctx.FormInt("page") if opts.Page <= 1 { opts.Page = 1 } @@ -44,8 +44,8 @@ func RenderUserSearch(ctx *context.Context, opts *models.SearchUserOptions, tplN orderBy models.SearchOrderBy ) - ctx.Data["SortType"] = ctx.Query("sort") - switch ctx.Query("sort") { + ctx.Data["SortType"] = ctx.Form("sort") + switch ctx.Form("sort") { case "newest": orderBy = models.SearchOrderByIDReverse case "oldest": @@ -63,7 +63,7 @@ func RenderUserSearch(ctx *context.Context, opts *models.SearchUserOptions, tplN orderBy = models.SearchOrderByAlphabetically } - opts.Keyword = strings.Trim(ctx.Query("q"), " ") + opts.Keyword = strings.Trim(ctx.Form("q"), " ") opts.OrderBy = orderBy if len(opts.Keyword) == 0 || isKeywordValid(opts.Keyword) { users, count, err = models.SearchUsers(opts) |