1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-24 11:18:36 +00:00

Rename context.Query to context.Form (#16562)

This commit is contained in:
Lunny Xiao
2021-07-29 09:42:15 +08:00
committed by GitHub
parent 3705168837
commit 33e0b38287
85 changed files with 393 additions and 396 deletions

View File

@@ -90,8 +90,8 @@ func EmailPost(ctx *context.Context) {
ctx.Data["PageIsSettingsAccount"] = true
// Make emailaddress primary.
if ctx.Query("_method") == "PRIMARY" {
if err := models.MakeEmailPrimary(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil {
if ctx.Form("_method") == "PRIMARY" {
if err := models.MakeEmailPrimary(&models.EmailAddress{ID: ctx.FormInt64("id")}); err != nil {
ctx.ServerError("MakeEmailPrimary", err)
return
}
@@ -101,7 +101,7 @@ func EmailPost(ctx *context.Context) {
return
}
// Send activation Email
if ctx.Query("_method") == "SENDACTIVATION" {
if ctx.Form("_method") == "SENDACTIVATION" {
var address string
if ctx.Cache.IsExist("MailResendLimit_" + ctx.User.LowerName) {
log.Error("Send activation: activation still pending")
@@ -109,7 +109,7 @@ func EmailPost(ctx *context.Context) {
return
}
id := ctx.QueryInt64("id")
id := ctx.FormInt64("id")
email, err := models.GetEmailAddressByID(ctx.User.ID, id)
if err != nil {
log.Error("GetEmailAddressByID(%d,%d) error: %v", ctx.User.ID, id, err)
@@ -147,8 +147,8 @@ func EmailPost(ctx *context.Context) {
return
}
// Set Email Notification Preference
if ctx.Query("_method") == "NOTIFICATION" {
preference := ctx.Query("preference")
if ctx.Form("_method") == "NOTIFICATION" {
preference := ctx.Form("preference")
if !(preference == models.EmailNotificationsEnabled ||
preference == models.EmailNotificationsOnMention ||
preference == models.EmailNotificationsDisabled) {
@@ -212,7 +212,7 @@ func EmailPost(ctx *context.Context) {
// DeleteEmail response for delete user's email
func DeleteEmail(ctx *context.Context) {
if err := models.DeleteEmailAddress(&models.EmailAddress{ID: ctx.QueryInt64("id"), UID: ctx.User.ID}); err != nil {
if err := models.DeleteEmailAddress(&models.EmailAddress{ID: ctx.FormInt64("id"), UID: ctx.User.ID}); err != nil {
ctx.ServerError("DeleteEmail", err)
return
}
@@ -229,7 +229,7 @@ func DeleteAccount(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsAccount"] = true
if _, err := auth.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {
if _, err := auth.UserSignIn(ctx.User.Name, ctx.Form("password")); err != nil {
if models.IsErrUserNotExist(err) {
loadAccountData(ctx)