summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/notify
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/api/v1/notify
parent370516883717de0e6e2087c12d368eb1465ee3b0 (diff)
downloadgitea-33e0b38287fdc3487112062300b8dd3c95415ee7.tar.gz
gitea-33e0b38287fdc3487112062300b8dd3c95415ee7.zip
Rename context.Query to context.Form (#16562)
Diffstat (limited to 'routers/api/v1/notify')
-rw-r--r--routers/api/v1/notify/notifications.go6
-rw-r--r--routers/api/v1/notify/repo.go8
-rw-r--r--routers/api/v1/notify/threads.go2
-rw-r--r--routers/api/v1/notify/user.go8
4 files changed, 12 insertions, 12 deletions
diff --git a/routers/api/v1/notify/notifications.go b/routers/api/v1/notify/notifications.go
index a5e095a3b5..9dd9da85c5 100644
--- a/routers/api/v1/notify/notifications.go
+++ b/routers/api/v1/notify/notifications.go
@@ -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)
}
diff --git a/routers/api/v1/notify/repo.go b/routers/api/v1/notify/repo.go
index af55d1d49c..b5a6d8abf0 100644
--- a/routers/api/v1/notify/repo.go
+++ b/routers/api/v1/notify/repo.go
@@ -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
}
diff --git a/routers/api/v1/notify/threads.go b/routers/api/v1/notify/threads.go
index efe5bcb59c..0865d12156 100644
--- a/routers/api/v1/notify/threads.go
+++ b/routers/api/v1/notify/threads.go
@@ -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
}
diff --git a/routers/api/v1/notify/user.go b/routers/api/v1/notify/user.go
index 475a541bdc..184091544a 100644
--- a/routers/api/v1/notify/user.go
+++ b/routers/api/v1/notify/user.go
@@ -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
}