summaryrefslogtreecommitdiffstats
path: root/routers/web/user/home.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-07-29 09:42:15 +0800
committerGitHub <noreply@github.com>2021-07-29 03:42:15 +0200
commit33e0b38287fdc3487112062300b8dd3c95415ee7 (patch)
tree603394d8f303de1031c21da0d3d3a3cdc0b2bfda /routers/web/user/home.go
parent370516883717de0e6e2087c12d368eb1465ee3b0 (diff)
downloadgitea-33e0b38287fdc3487112062300b8dd3c95415ee7.tar.gz
gitea-33e0b38287fdc3487112062300b8dd3c95415ee7.zip
Rename context.Query to context.Form (#16562)
Diffstat (limited to 'routers/web/user/home.go')
-rw-r--r--routers/web/user/home.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/routers/web/user/home.go b/routers/web/user/home.go
index fcf5295c9e..3b89840720 100644
--- a/routers/web/user/home.go
+++ b/routers/web/user/home.go
@@ -157,7 +157,7 @@ func Dashboard(ctx *context.Context) {
IncludePrivate: true,
OnlyPerformedBy: false,
IncludeDeleted: false,
- Date: ctx.Query("date"),
+ Date: ctx.Form("date"),
})
if ctx.Written() {
@@ -200,11 +200,11 @@ func Milestones(ctx *context.Context) {
repoCond = userRepoCond
repoIDs []int64
- reposQuery = ctx.Query("repos")
- isShowClosed = ctx.Query("state") == "closed"
- sortType = ctx.Query("sort")
- page = ctx.QueryInt("page")
- keyword = strings.Trim(ctx.Query("q"), " ")
+ reposQuery = ctx.Form("repos")
+ isShowClosed = ctx.Form("state") == "closed"
+ sortType = ctx.Form("sort")
+ page = ctx.FormInt("page")
+ keyword = strings.Trim(ctx.Form("q"), " ")
)
if page <= 1 {
@@ -380,7 +380,7 @@ func buildIssueOverview(ctx *context.Context, unitType models.UnitType) {
var (
viewType string
- sortType = ctx.Query("sort")
+ sortType = ctx.Form("sort")
filterMode = models.FilterModeAll
)
@@ -390,14 +390,14 @@ func buildIssueOverview(ctx *context.Context, unitType models.UnitType) {
// - Remember pre-determined viewType string for later. Will be posted to ctx.Data.
// Organization does not have view type and filter mode.
// User:
- // - Use ctx.Query("type") to determine filterMode.
+ // - Use ctx.Form("type") to determine filterMode.
// The type is set when clicking for example "assigned to me" on the overview page.
// - Remember either this or a fallback. Will be posted to ctx.Data.
// --------------------------------------------------------------------------------
// TODO: distinguish during routing
- viewType = ctx.Query("type")
+ viewType = ctx.Form("type")
switch viewType {
case "assigned":
filterMode = models.FilterModeAssign
@@ -456,7 +456,7 @@ func buildIssueOverview(ctx *context.Context, unitType models.UnitType) {
}
// keyword holds the search term entered into the search field.
- keyword := strings.Trim(ctx.Query("q"), " ")
+ keyword := strings.Trim(ctx.Form("q"), " ")
ctx.Data["Keyword"] = keyword
// Execute keyword search for issues.
@@ -477,7 +477,7 @@ func buildIssueOverview(ctx *context.Context, unitType models.UnitType) {
}
// Educated guess: Do or don't show closed issues.
- isShowClosed := ctx.Query("state") == "closed"
+ isShowClosed := ctx.Form("state") == "closed"
opts.IsClosed = util.OptionalBoolOf(isShowClosed)
// Filter repos and count issues in them. Count will be used later.
@@ -492,7 +492,7 @@ func buildIssueOverview(ctx *context.Context, unitType models.UnitType) {
}
// Make sure page number is at least 1. Will be posted to ctx.Data.
- page := ctx.QueryInt("page")
+ page := ctx.FormInt("page")
if page <= 1 {
page = 1
}
@@ -502,7 +502,7 @@ func buildIssueOverview(ctx *context.Context, unitType models.UnitType) {
// Get IDs for labels (a filter option for issues/pulls).
// Required for IssuesOptions.
var labelIDs []int64
- selectedLabels := ctx.Query("labels")
+ selectedLabels := ctx.Form("labels")
if len(selectedLabels) > 0 && selectedLabels != "0" {
labelIDs, err = base.StringsToInt64s(strings.Split(selectedLabels, ","))
if err != nil {
@@ -512,9 +512,9 @@ func buildIssueOverview(ctx *context.Context, unitType models.UnitType) {
}
opts.LabelIDs = labelIDs
- // Parse ctx.Query("repos") and remember matched repo IDs for later.
+ // Parse ctx.Form("repos") and remember matched repo IDs for later.
// Gets set when clicking filters on the issues overview page.
- repoIDs := getRepoIDs(ctx.Query("repos"))
+ repoIDs := getRepoIDs(ctx.Form("repos"))
if len(repoIDs) > 0 {
opts.RepoIDs = repoIDs
}
@@ -658,7 +658,7 @@ func buildIssueOverview(ctx *context.Context, unitType models.UnitType) {
ctx.Data["IsShowClosed"] = isShowClosed
ctx.Data["IssueRefEndNames"], ctx.Data["IssueRefURLs"] =
- issue_service.GetRefEndNamesAndURLs(issues, ctx.Query("RepoLink"))
+ issue_service.GetRefEndNamesAndURLs(issues, ctx.Form("RepoLink"))
ctx.Data["Issues"] = issues
@@ -900,7 +900,7 @@ func ShowGPGKeys(ctx *context.Context, uid int64) {
// Email2User show user page via email
func Email2User(ctx *context.Context) {
- u, err := models.GetUserByEmail(ctx.Query("email"))
+ u, err := models.GetUserByEmail(ctx.Form("email"))
if err != nil {
if models.IsErrUserNotExist(err) {
ctx.NotFound("GetUserByEmail", err)