summaryrefslogtreecommitdiffstats
path: root/routers/web/org
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/org
parent370516883717de0e6e2087c12d368eb1465ee3b0 (diff)
downloadgitea-33e0b38287fdc3487112062300b8dd3c95415ee7.tar.gz
gitea-33e0b38287fdc3487112062300b8dd3c95415ee7.zip
Rename context.Query to context.Form (#16562)
Diffstat (limited to 'routers/web/org')
-rw-r--r--routers/web/org/home.go8
-rw-r--r--routers/web/org/members.go4
-rw-r--r--routers/web/org/org_labels.go6
-rw-r--r--routers/web/org/setting.go4
-rw-r--r--routers/web/org/teams.go10
5 files changed, 16 insertions, 16 deletions
diff --git a/routers/web/org/home.go b/routers/web/org/home.go
index aad0a2a90b..8c1475d469 100644
--- a/routers/web/org/home.go
+++ b/routers/web/org/home.go
@@ -51,8 +51,8 @@ func Home(ctx *context.Context) {
}
var 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":
@@ -78,10 +78,10 @@ func Home(ctx *context.Context) {
orderBy = models.SearchOrderByRecentUpdated
}
- keyword := strings.Trim(ctx.Query("q"), " ")
+ keyword := strings.Trim(ctx.Form("q"), " ")
ctx.Data["Keyword"] = keyword
- page := ctx.QueryInt("page")
+ page := ctx.FormInt("page")
if page <= 0 {
page = 1
}
diff --git a/routers/web/org/members.go b/routers/web/org/members.go
index 934529d7d7..2989637a61 100644
--- a/routers/web/org/members.go
+++ b/routers/web/org/members.go
@@ -26,7 +26,7 @@ func Members(ctx *context.Context) {
ctx.Data["Title"] = org.FullName
ctx.Data["PageIsOrgMembers"] = true
- page := ctx.QueryInt("page")
+ page := ctx.FormInt("page")
if page <= 1 {
page = 1
}
@@ -70,7 +70,7 @@ func Members(ctx *context.Context) {
// MembersAction response for operation to a member of organization
func MembersAction(ctx *context.Context) {
- uid := ctx.QueryInt64("uid")
+ uid := ctx.FormInt64("uid")
if uid == 0 {
ctx.Redirect(ctx.Org.OrgLink + "/members")
return
diff --git a/routers/web/org/org_labels.go b/routers/web/org/org_labels.go
index 26e232bcc9..08457d4f8e 100644
--- a/routers/web/org/org_labels.go
+++ b/routers/web/org/org_labels.go
@@ -15,7 +15,7 @@ import (
// RetrieveLabels find all the labels of an organization
func RetrieveLabels(ctx *context.Context) {
- labels, err := models.GetLabelsByOrgID(ctx.Org.Organization.ID, ctx.Query("sort"), models.ListOptions{})
+ labels, err := models.GetLabelsByOrgID(ctx.Org.Organization.ID, ctx.Form("sort"), models.ListOptions{})
if err != nil {
ctx.ServerError("RetrieveLabels.GetLabels", err)
return
@@ -25,7 +25,7 @@ func RetrieveLabels(ctx *context.Context) {
}
ctx.Data["Labels"] = labels
ctx.Data["NumLabels"] = len(labels)
- ctx.Data["SortType"] = ctx.Query("sort")
+ ctx.Data["SortType"] = ctx.Form("sort")
}
// NewLabel create new label for organization
@@ -79,7 +79,7 @@ func UpdateLabel(ctx *context.Context) {
// DeleteLabel delete a label
func DeleteLabel(ctx *context.Context) {
- if err := models.DeleteLabel(ctx.Org.Organization.ID, ctx.QueryInt64("id")); err != nil {
+ if err := models.DeleteLabel(ctx.Org.Organization.ID, ctx.FormInt64("id")); err != nil {
ctx.Flash.Error("DeleteLabel: " + err.Error())
} else {
ctx.Flash.Success(ctx.Tr("repo.issues.label_deletion_success"))
diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go
index e848939187..47a80ec50f 100644
--- a/routers/web/org/setting.go
+++ b/routers/web/org/setting.go
@@ -155,7 +155,7 @@ func SettingsDelete(ctx *context.Context) {
org := ctx.Org.Organization
if ctx.Req.Method == "POST" {
- if org.Name != ctx.Query("org_name") {
+ if org.Name != ctx.Form("org_name") {
ctx.Data["Err_OrgName"] = true
ctx.RenderWithErr(ctx.Tr("form.enterred_invalid_org_name"), tplSettingsDelete, nil)
return
@@ -198,7 +198,7 @@ func Webhooks(ctx *context.Context) {
// DeleteWebhook response for delete webhook
func DeleteWebhook(ctx *context.Context) {
- if err := models.DeleteWebhookByOrgID(ctx.Org.Organization.ID, ctx.QueryInt64("id")); err != nil {
+ if err := models.DeleteWebhookByOrgID(ctx.Org.Organization.ID, ctx.FormInt64("id")); err != nil {
ctx.Flash.Error("DeleteWebhookByOrgID: " + err.Error())
} else {
ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success"))
diff --git a/routers/web/org/teams.go b/routers/web/org/teams.go
index e612cd767c..a61315e05c 100644
--- a/routers/web/org/teams.go
+++ b/routers/web/org/teams.go
@@ -49,13 +49,13 @@ func Teams(ctx *context.Context) {
// TeamsAction response for join, leave, remove, add operations to team
func TeamsAction(ctx *context.Context) {
- uid := ctx.QueryInt64("uid")
+ uid := ctx.FormInt64("uid")
if uid == 0 {
ctx.Redirect(ctx.Org.OrgLink + "/teams")
return
}
- page := ctx.Query("page")
+ page := ctx.Form("page")
var err error
switch ctx.Params(":action") {
case "join":
@@ -78,7 +78,7 @@ func TeamsAction(ctx *context.Context) {
ctx.Error(http.StatusNotFound)
return
}
- uname := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.Query("uname")))
+ uname := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.Form("uname")))
var u *models.User
u, err = models.GetUserByName(uname)
if err != nil {
@@ -140,7 +140,7 @@ func TeamsRepoAction(ctx *context.Context) {
action := ctx.Params(":action")
switch action {
case "add":
- repoName := path.Base(ctx.Query("repo_name"))
+ repoName := path.Base(ctx.Form("repo_name"))
var repo *models.Repository
repo, err = models.GetRepositoryByName(ctx.Org.Organization.ID, repoName)
if err != nil {
@@ -154,7 +154,7 @@ func TeamsRepoAction(ctx *context.Context) {
}
err = ctx.Org.Team.AddRepository(repo)
case "remove":
- err = ctx.Org.Team.RemoveRepository(ctx.QueryInt64("repoid"))
+ err = ctx.Org.Team.RemoveRepository(ctx.FormInt64("repoid"))
case "addall":
err = ctx.Org.Team.AddAllRepositories()
case "removeall":