summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-09-30 21:50:44 +0800
committerGitHub <noreply@github.com>2019-09-30 21:50:44 +0800
commite6113000c5cbbdbf10af7bda472fc8b254ec7605 (patch)
treee7b9fd86a4e7451083c298d29f09ecaaedf9970c /routers
parenta5992d172551f7821e023cd3cbca1a7cc0b919ee (diff)
downloadgitea-e6113000c5cbbdbf10af7bda472fc8b254ec7605.tar.gz
gitea-e6113000c5cbbdbf10af7bda472fc8b254ec7605.zip
Extract actions on new issue from models to services (#8217)
* extract actions on new issue from models to services * improve code * rename services/issues to services/issue
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/issue.go3
-rw-r--r--routers/repo/issue.go3
2 files changed, 4 insertions, 2 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 6f502a5abd..aab167bc68 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -19,6 +19,7 @@ import (
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
+ issue_service "code.gitea.io/gitea/services/issue"
milestone_service "code.gitea.io/gitea/services/milestone"
)
@@ -217,7 +218,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
form.Labels = make([]int64, 0)
}
- if err := models.NewIssue(ctx.Repo.Repository, issue, form.Labels, assigneeIDs, nil); err != nil {
+ if err := issue_service.NewIssue(ctx.Repo.Repository, issue, form.Labels, assigneeIDs, nil); err != nil {
if models.IsErrUserDoesNotHaveAccessToRepo(err) {
ctx.Error(400, "UserDoesNotHaveAccessToRepo", err)
return
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 1be0b408a6..e4ef3b1dbb 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -27,6 +27,7 @@ import (
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
comment_service "code.gitea.io/gitea/services/comments"
+ issue_service "code.gitea.io/gitea/services/issue"
milestone_service "code.gitea.io/gitea/services/milestone"
"github.com/unknwon/com"
@@ -571,7 +572,7 @@ func NewIssuePost(ctx *context.Context, form auth.CreateIssueForm) {
Content: form.Content,
Ref: form.Ref,
}
- if err := models.NewIssue(repo, issue, labelIDs, assigneeIDs, attachments); err != nil {
+ if err := issue_service.NewIssue(repo, issue, labelIDs, assigneeIDs, attachments); err != nil {
if models.IsErrUserDoesNotHaveAccessToRepo(err) {
ctx.Error(400, "UserDoesNotHaveAccessToRepo", err.Error())
return