diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-03-23 05:54:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-23 12:54:07 +0800 |
commit | 3f280f89e7471a6dcdaefccc64a8d39188970e63 (patch) | |
tree | ff09b6dcb00b4c0ff0c436c4523d89a5c13f3a94 /routers/web/admin | |
parent | 395117d3014124b9147a1aabf76ee175e720b275 (diff) | |
download | gitea-3f280f89e7471a6dcdaefccc64a8d39188970e63.tar.gz gitea-3f280f89e7471a6dcdaefccc64a8d39188970e63.zip |
Update HTTP status codes to modern codes (#18063)
* 2xx/3xx/4xx/5xx -> http.Status...
* http.StatusFound -> http.StatusTemporaryRedirect
* http.StatusMovedPermanently -> http.StatusPermanentRedirect
Diffstat (limited to 'routers/web/admin')
-rw-r--r-- | routers/web/admin/admin.go | 10 | ||||
-rw-r--r-- | routers/web/admin/notice.go | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/routers/web/admin/admin.go b/routers/web/admin/admin.go index 63bc7de7d7..4c700df354 100644 --- a/routers/web/admin/admin.go +++ b/routers/web/admin/admin.go @@ -346,7 +346,7 @@ func Queue(ctx *context.Context) { qid := ctx.ParamsInt64("qid") mq := queue.GetManager().GetManagedQueue(qid) if mq == nil { - ctx.Status(404) + ctx.Status(http.StatusNotFound) return } ctx.Data["Title"] = ctx.Tr("admin.monitor.queue", mq.Name) @@ -361,7 +361,7 @@ func WorkerCancel(ctx *context.Context) { qid := ctx.ParamsInt64("qid") mq := queue.GetManager().GetManagedQueue(qid) if mq == nil { - ctx.Status(404) + ctx.Status(http.StatusNotFound) return } pid := ctx.ParamsInt64("pid") @@ -377,7 +377,7 @@ func Flush(ctx *context.Context) { qid := ctx.ParamsInt64("qid") mq := queue.GetManager().GetManagedQueue(qid) if mq == nil { - ctx.Status(404) + ctx.Status(http.StatusNotFound) return } timeout, err := time.ParseDuration(ctx.FormString("timeout")) @@ -423,7 +423,7 @@ func AddWorkers(ctx *context.Context) { qid := ctx.ParamsInt64("qid") mq := queue.GetManager().GetManagedQueue(qid) if mq == nil { - ctx.Status(404) + ctx.Status(http.StatusNotFound) return } number := ctx.FormInt("number") @@ -453,7 +453,7 @@ func SetQueueSettings(ctx *context.Context) { qid := ctx.ParamsInt64("qid") mq := queue.GetManager().GetManagedQueue(qid) if mq == nil { - ctx.Status(404) + ctx.Status(http.StatusNotFound) return } if _, ok := mq.Managed.(queue.ManagedPool); !ok { diff --git a/routers/web/admin/notice.go b/routers/web/admin/notice.go index 147e03ba03..b50549b804 100644 --- a/routers/web/admin/notice.go +++ b/routers/web/admin/notice.go @@ -59,10 +59,10 @@ func DeleteNotices(ctx *context.Context) { if err := admin_model.DeleteNoticesByIDs(ids); err != nil { ctx.Flash.Error("DeleteNoticesByIDs: " + err.Error()) - ctx.Status(500) + ctx.Status(http.StatusInternalServerError) } else { ctx.Flash.Success(ctx.Tr("admin.notices.delete_success")) - ctx.Status(200) + ctx.Status(http.StatusOK) } } |