Skip to content

Commit

Permalink
Use ctx but db.DefaultContext
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Mar 24, 2022
1 parent a29cb0a commit 29d1851
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions routers/api/v1/org/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"strings"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
Expand Down Expand Up @@ -100,7 +99,7 @@ func CreateLabel(ctx *context.APIContext) {
OrgID: ctx.Org.Organization.ID,
Description: form.Description,
}
if err := models.NewLabel(db.DefaultContext, label); err != nil {
if err := models.NewLabel(ctx, label); err != nil {
ctx.Error(http.StatusInternalServerError, "NewLabel", err)
return
}
Expand Down
3 changes: 1 addition & 2 deletions routers/api/v1/repo/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"strings"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
Expand Down Expand Up @@ -162,7 +161,7 @@ func CreateLabel(ctx *context.APIContext) {
RepoID: ctx.Repo.Repository.ID,
Description: form.Description,
}
if err := models.NewLabel(db.DefaultContext, label); err != nil {
if err := models.NewLabel(ctx, label); err != nil {
ctx.Error(http.StatusInternalServerError, "NewLabel", err)
return
}
Expand Down
2 changes: 1 addition & 1 deletion routers/web/org/org_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewLabel(ctx *context.Context) {
Description: form.Description,
Color: form.Color,
}
if err := models.NewLabel(db.DefaultContext, l); err != nil {
if err := models.NewLabel(ctx, l); err != nil {
ctx.ServerError("NewLabel", err)
return
}
Expand Down
2 changes: 1 addition & 1 deletion routers/web/repo/issue_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func NewLabel(ctx *context.Context) {
Description: form.Description,
Color: form.Color,
}
if err := models.NewLabel(db.DefaultContext, l); err != nil {
if err := models.NewLabel(ctx, l); err != nil {
ctx.ServerError("NewLabel", err)
return
}
Expand Down

0 comments on commit 29d1851

Please sign in to comment.