mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 18:58:38 +00:00
Rename context.Query to context.Form (#16562)
This commit is contained in:
@@ -37,12 +37,12 @@ func getFindNotificationOptions(ctx *context.APIContext) *models.FindNotificatio
|
||||
UpdatedBeforeUnix: before,
|
||||
UpdatedAfterUnix: since,
|
||||
}
|
||||
if !ctx.QueryBool("all") {
|
||||
statuses := ctx.QueryStrings("status-types")
|
||||
if !ctx.FormBool("all") {
|
||||
statuses := ctx.FormStrings("status-types")
|
||||
opts.Status = statusStringsToNotificationStatuses(statuses, []string{"unread", "pinned"})
|
||||
}
|
||||
|
||||
subjectTypes := ctx.QueryStrings("subject-type")
|
||||
subjectTypes := ctx.FormStrings("subject-type")
|
||||
if len(subjectTypes) != 0 {
|
||||
opts.Source = subjectToSource(subjectTypes)
|
||||
}
|
||||
|
@@ -171,7 +171,7 @@ func ReadRepoNotifications(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/empty"
|
||||
|
||||
lastRead := int64(0)
|
||||
qLastRead := strings.Trim(ctx.Query("last_read_at"), " ")
|
||||
qLastRead := strings.Trim(ctx.Form("last_read_at"), " ")
|
||||
if len(qLastRead) > 0 {
|
||||
tmpLastRead, err := time.Parse(time.RFC3339, qLastRead)
|
||||
if err != nil {
|
||||
@@ -189,8 +189,8 @@ func ReadRepoNotifications(ctx *context.APIContext) {
|
||||
UpdatedBeforeUnix: lastRead,
|
||||
}
|
||||
|
||||
if !ctx.QueryBool("all") {
|
||||
statuses := ctx.QueryStrings("status-types")
|
||||
if !ctx.FormBool("all") {
|
||||
statuses := ctx.FormStrings("status-types")
|
||||
opts.Status = statusStringsToNotificationStatuses(statuses, []string{"unread"})
|
||||
log.Error("%v", opts.Status)
|
||||
}
|
||||
@@ -200,7 +200,7 @@ func ReadRepoNotifications(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
targetStatus := statusStringToNotificationStatus(ctx.Query("to-status"))
|
||||
targetStatus := statusStringToNotificationStatus(ctx.Form("to-status"))
|
||||
if targetStatus == 0 {
|
||||
targetStatus = models.NotificationStatusRead
|
||||
}
|
||||
|
@@ -82,7 +82,7 @@ func ReadThread(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
targetStatus := statusStringToNotificationStatus(ctx.Query("to-status"))
|
||||
targetStatus := statusStringToNotificationStatus(ctx.Form("to-status"))
|
||||
if targetStatus == 0 {
|
||||
targetStatus = models.NotificationStatusRead
|
||||
}
|
||||
|
@@ -122,7 +122,7 @@ func ReadNotifications(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/empty"
|
||||
|
||||
lastRead := int64(0)
|
||||
qLastRead := strings.Trim(ctx.Query("last_read_at"), " ")
|
||||
qLastRead := strings.Trim(ctx.Form("last_read_at"), " ")
|
||||
if len(qLastRead) > 0 {
|
||||
tmpLastRead, err := time.Parse(time.RFC3339, qLastRead)
|
||||
if err != nil {
|
||||
@@ -137,8 +137,8 @@ func ReadNotifications(ctx *context.APIContext) {
|
||||
UserID: ctx.User.ID,
|
||||
UpdatedBeforeUnix: lastRead,
|
||||
}
|
||||
if !ctx.QueryBool("all") {
|
||||
statuses := ctx.QueryStrings("status-types")
|
||||
if !ctx.FormBool("all") {
|
||||
statuses := ctx.FormStrings("status-types")
|
||||
opts.Status = statusStringsToNotificationStatuses(statuses, []string{"unread"})
|
||||
}
|
||||
nl, err := models.GetNotifications(opts)
|
||||
@@ -147,7 +147,7 @@ func ReadNotifications(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
targetStatus := statusStringToNotificationStatus(ctx.Query("to-status"))
|
||||
targetStatus := statusStringToNotificationStatus(ctx.Form("to-status"))
|
||||
if targetStatus == 0 {
|
||||
targetStatus = models.NotificationStatusRead
|
||||
}
|
||||
|
Reference in New Issue
Block a user