Move init repository related functions to modules (#19159)

* Move init repository related functions to modules

* Fix lint

* Use ctx but db.DefaultContext

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Lunny Xiaoandwxiaoguang authored and GitHub committed 2022-03-29 15:23:45 +08:00
1 parent b06b9a056c
commit 76aa33d884
15 files changed
+259 -269

No files matched your search

+1 -1
View File
@@ -99,7 +99,7 @@ func CreateLabel(ctx *context.APIContext) {
OrgID: ctx.Org.Organization.ID,
Description: form.Description,
}
if err := models.NewLabel(label); err != nil {
if err := models.NewLabel(ctx, label); err != nil {
ctx.Error(http.StatusInternalServerError, "NewLabel", err)
return
}
+1 -1
View File
@@ -161,7 +161,7 @@ func CreateLabel(ctx *context.APIContext) {
RepoID: ctx.Repo.Repository.ID,
Description: form.Description,
}
if err := models.NewLabel(label); err != nil {
if err := models.NewLabel(ctx, label); err != nil {
ctx.Error(http.StatusInternalServerError, "NewLabel", err)
return
}