summaryrefslogtreecommitdiffstats
path: root/routers/repo/release.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-09-15 23:28:25 +0800
committerGitHub <noreply@github.com>2019-09-15 23:28:25 +0800
commit4959bf1c097917576472f9f66afa0fb615500c07 (patch)
tree9c2db8d5a91c1e6d97a1e66470347b647d01cfb0 /routers/repo/release.go
parentbe0f7ff9bf6da5b1642a98ff02f313ba39ee4518 (diff)
downloadgitea-4959bf1c097917576472f9f66afa0fb615500c07.tar.gz
gitea-4959bf1c097917576472f9f66afa0fb615500c07.zip
Move create release from models to a standalone package (#7539)
* move create release from models to a standalone package * fix lint * fix comment year * fix lint * fix lint * fix package import name * fix vendor * fix go mod * some refactors * fix vendor * use go1.12 make vendor * fix vendor
Diffstat (limited to 'routers/repo/release.go')
-rw-r--r--routers/repo/release.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/routers/repo/release.go b/routers/repo/release.go
index fdef533f10..95423a92b2 100644
--- a/routers/repo/release.go
+++ b/routers/repo/release.go
@@ -15,6 +15,7 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/setting"
+ releaseservice "code.gitea.io/gitea/services/release"
)
const (
@@ -175,7 +176,7 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) {
IsTag: false,
}
- if err = models.CreateRelease(ctx.Repo.GitRepo, rel, attachmentUUIDs); err != nil {
+ if err = releaseservice.CreateRelease(ctx.Repo.GitRepo, rel, attachmentUUIDs); err != nil {
ctx.Data["Err_TagName"] = true
switch {
case models.IsErrReleaseAlreadyExist(err):
@@ -202,7 +203,7 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) {
rel.PublisherID = ctx.User.ID
rel.IsTag = false
- if err = models.UpdateRelease(ctx.User, ctx.Repo.GitRepo, rel, attachmentUUIDs); err != nil {
+ if err = releaseservice.UpdateRelease(ctx.User, ctx.Repo.GitRepo, rel, attachmentUUIDs); err != nil {
ctx.Data["Err_TagName"] = true
ctx.ServerError("UpdateRelease", err)
return
@@ -281,7 +282,7 @@ func EditReleasePost(ctx *context.Context, form auth.EditReleaseForm) {
rel.Note = form.Content
rel.IsDraft = len(form.Draft) > 0
rel.IsPrerelease = form.Prerelease
- if err = models.UpdateRelease(ctx.User, ctx.Repo.GitRepo, rel, attachmentUUIDs); err != nil {
+ if err = releaseservice.UpdateRelease(ctx.User, ctx.Repo.GitRepo, rel, attachmentUUIDs); err != nil {
ctx.ServerError("UpdateRelease", err)
return
}