mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-29 03:38:52 +03:00
Code cleanup in the actions.ViewLatest route handler
Based on feedback received after the feature was merged, use `ctx.NotFound` and `ctx.ServerError`, and drop the use of the unnecessary `ctx.Written()`. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
parent
c3f487af49
commit
74e42da563
1 changed files with 2 additions and 4 deletions
|
@ -49,14 +49,12 @@ func View(ctx *context_module.Context) {
|
||||||
func ViewLatest(ctx *context_module.Context) {
|
func ViewLatest(ctx *context_module.Context) {
|
||||||
run, err := actions_model.GetLatestRun(ctx, ctx.Repo.Repository.ID)
|
run, err := actions_model.GetLatestRun(ctx, ctx.Repo.Repository.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusNotFound, err.Error())
|
ctx.NotFound("GetLatestRun", err)
|
||||||
ctx.Written()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = run.LoadAttributes(ctx)
|
err = run.LoadAttributes(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, err.Error())
|
ctx.ServerError("LoadAttributes", err)
|
||||||
ctx.Written()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Redirect(run.HTMLURL(), http.StatusTemporaryRedirect)
|
ctx.Redirect(run.HTMLURL(), http.StatusTemporaryRedirect)
|
||||||
|
|
Loading…
Reference in a new issue