mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-06 02:15:20 +02:00
Handle refactor (#3339)
* Replace all ctx.Handle with ctx.ServerError or ctx.NotFound * Change Handle(403) to NotFound, avoid using macaron's NotFound
This commit is contained in:
parent
45c264f681
commit
65861900cd
48 changed files with 622 additions and 610 deletions
|
@ -18,12 +18,12 @@ func IssueStopwatch(c *context.Context) {
|
|||
return
|
||||
}
|
||||
if !c.Repo.CanUseTimetracker(issue, c.User) {
|
||||
c.Handle(http.StatusNotFound, "CanUseTimetracker", nil)
|
||||
c.NotFound("CanUseTimetracker", nil)
|
||||
return
|
||||
}
|
||||
|
||||
if err := models.CreateOrStopIssueStopwatch(c.User, issue); err != nil {
|
||||
c.Handle(http.StatusInternalServerError, "CreateOrStopIssueStopwatch", err)
|
||||
c.ServerError("CreateOrStopIssueStopwatch", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -38,12 +38,12 @@ func CancelStopwatch(c *context.Context) {
|
|||
return
|
||||
}
|
||||
if !c.Repo.CanUseTimetracker(issue, c.User) {
|
||||
c.Handle(http.StatusNotFound, "CanUseTimetracker", nil)
|
||||
c.NotFound("CanUseTimetracker", nil)
|
||||
return
|
||||
}
|
||||
|
||||
if err := models.CancelStopwatch(c.User, issue); err != nil {
|
||||
c.Handle(http.StatusInternalServerError, "CancelStopwatch", err)
|
||||
c.ServerError("CancelStopwatch", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue