aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-09-18 08:17:12 +0800
committerGitHub <noreply@github.com>2019-09-18 08:17:12 +0800
commit29454733b4eeea33e6c94c50b32855066c203988 (patch)
tree8b6317a23c7a51a83dea1a674b76084c225397e1 /routers
parent99f3ee3bf3ff969097a0b9a2627533af476a0461 (diff)
downloadgitea-29454733b4eeea33e6c94c50b32855066c203988.tar.gz
gitea-29454733b4eeea33e6c94c50b32855066c203988.zip
move some milestone functions to a standalone package (#8213)
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/issue.go3
-rw-r--r--routers/api/v1/repo/pull.go3
-rw-r--r--routers/repo/issue.go3
3 files changed, 6 insertions, 3 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 402da82f07..6f502a5abd 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"
+ milestone_service "code.gitea.io/gitea/services/milestone"
)
// ListIssues list the issues of a repository
@@ -345,7 +346,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
issue.MilestoneID != *form.Milestone {
oldMilestoneID := issue.MilestoneID
issue.MilestoneID = *form.Milestone
- if err = models.ChangeMilestoneAssign(issue, ctx.User, oldMilestoneID); err != nil {
+ if err = milestone_service.ChangeMilestoneAssign(issue, ctx.User, oldMilestoneID); err != nil {
ctx.Error(500, "ChangeMilestoneAssign", err)
return
}
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 5ac542ec20..7be34c656e 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -18,6 +18,7 @@ import (
"code.gitea.io/gitea/modules/pull"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
+ milestone_service "code.gitea.io/gitea/services/milestone"
)
// ListPullRequests returns a list of all PRs
@@ -402,7 +403,7 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
issue.MilestoneID != form.Milestone {
oldMilestoneID := issue.MilestoneID
issue.MilestoneID = form.Milestone
- if err = models.ChangeMilestoneAssign(issue, ctx.User, oldMilestoneID); err != nil {
+ if err = milestone_service.ChangeMilestoneAssign(issue, ctx.User, oldMilestoneID); err != nil {
ctx.Error(500, "ChangeMilestoneAssign", err)
return
}
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index dc09a650fe..4ae791221c 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -26,6 +26,7 @@ import (
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
+ milestone_service "code.gitea.io/gitea/services/milestone"
"github.com/unknwon/com"
)
@@ -1086,7 +1087,7 @@ func UpdateIssueMilestone(ctx *context.Context) {
continue
}
issue.MilestoneID = milestoneID
- if err := models.ChangeMilestoneAssign(issue, ctx.User, oldMilestoneID); err != nil {
+ if err := milestone_service.ChangeMilestoneAssign(issue, ctx.User, oldMilestoneID); err != nil {
ctx.ServerError("ChangeMilestoneAssign", err)
return
}