1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 02:38:35 +00:00

Move milestone to models/issues/ (#19278)

* Move milestone to models/issues/

* Fix lint

* Fix test

* Fix lint

* Fix lint
This commit is contained in:
Lunny Xiao
2022-04-08 17:11:15 +08:00
committed by GitHub
parent 84ceaa98bd
commit 1dfa26e00e
56 changed files with 466 additions and 447 deletions

View File

@@ -64,18 +64,18 @@ func CancelStopwatch(c *context.Context) {
}
// GetActiveStopwatch is the middleware that sets .ActiveStopwatch on context
func GetActiveStopwatch(c *context.Context) {
if strings.HasPrefix(c.Req.URL.Path, "/api") {
func GetActiveStopwatch(ctx *context.Context) {
if strings.HasPrefix(ctx.Req.URL.Path, "/api") {
return
}
if !c.IsSigned {
if !ctx.IsSigned {
return
}
_, sw, err := models.HasUserStopwatch(c.Doer.ID)
_, sw, err := models.HasUserStopwatch(ctx.Doer.ID)
if err != nil {
c.ServerError("HasUserStopwatch", err)
ctx.ServerError("HasUserStopwatch", err)
return
}
@@ -85,15 +85,15 @@ func GetActiveStopwatch(c *context.Context) {
issue, err := models.GetIssueByID(sw.IssueID)
if err != nil || issue == nil {
c.ServerError("GetIssueByID", err)
ctx.ServerError("GetIssueByID", err)
return
}
if err = issue.LoadRepo(); err != nil {
c.ServerError("LoadRepo", err)
if err = issue.LoadRepo(ctx); err != nil {
ctx.ServerError("LoadRepo", err)
return
}
c.Data["ActiveStopwatch"] = StopwatchTmplInfo{
ctx.Data["ActiveStopwatch"] = StopwatchTmplInfo{
issue.Link(),
issue.Repo.FullName(),
issue.Index,