summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
author赵智超 <1012112796@qq.com>2020-07-30 03:20:54 +0800
committerGitHub <noreply@github.com>2020-07-29 15:20:54 -0400
commit1f12dc8e8862da8546fd9d984abdc7f69dd95f11 (patch)
treec90da9326eb89dc57cf7e9625fe34542a88b41b4 /routers
parent2fd78c151e0e49db113078095f1d9e8c7478e828 (diff)
downloadgitea-1f12dc8e8862da8546fd9d984abdc7f69dd95f11.tar.gz
gitea-1f12dc8e8862da8546fd9d984abdc7f69dd95f11.zip
Add action feed for new release (#12324)
* Add action feed for new release Signed-off-by: a1012112796 <1012112796@qq.com> * fix lint * Apply suggestions from code review * Add ReleaseID to the action table * Remove error message * Fold the attachments download list * remove attchment download list * simplify code * fix create release from existing tag * simplify ui * translation change * fix test Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/release.go8
-rw-r--r--routers/repo/release.go8
2 files changed, 8 insertions, 8 deletions
diff --git a/routers/api/v1/repo/release.go b/routers/api/v1/repo/release.go
index ade82f24cb..752b5c76e0 100644
--- a/routers/api/v1/repo/release.go
+++ b/routers/api/v1/repo/release.go
@@ -194,8 +194,8 @@ func CreateRelease(ctx *context.APIContext, form api.CreateReleaseOption) {
rel.Repo = ctx.Repo.Repository
rel.Publisher = ctx.User
- if err = releaseservice.UpdateRelease(ctx.User, ctx.Repo.GitRepo, rel, nil); err != nil {
- ctx.ServerError("UpdateRelease", err)
+ if err = releaseservice.UpdateReleaseOrCreatReleaseFromTag(ctx.User, ctx.Repo.GitRepo, rel, nil, true); err != nil {
+ ctx.ServerError("UpdateReleaseOrCreatReleaseFromTag", err)
return
}
}
@@ -266,8 +266,8 @@ func EditRelease(ctx *context.APIContext, form api.EditReleaseOption) {
if form.IsPrerelease != nil {
rel.IsPrerelease = *form.IsPrerelease
}
- if err := releaseservice.UpdateRelease(ctx.User, ctx.Repo.GitRepo, rel, nil); err != nil {
- ctx.Error(http.StatusInternalServerError, "UpdateRelease", err)
+ if err := releaseservice.UpdateReleaseOrCreatReleaseFromTag(ctx.User, ctx.Repo.GitRepo, rel, nil, false); err != nil {
+ ctx.Error(http.StatusInternalServerError, "UpdateReleaseOrCreatReleaseFromTag", err)
return
}
diff --git a/routers/repo/release.go b/routers/repo/release.go
index 3b8e55f002..02fbcaccaf 100644
--- a/routers/repo/release.go
+++ b/routers/repo/release.go
@@ -223,7 +223,7 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) {
return
}
- rel := &models.Release{
+ rel = &models.Release{
RepoID: ctx.Repo.Repository.ID,
PublisherID: ctx.User.ID,
Title: form.Title,
@@ -262,9 +262,9 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) {
rel.PublisherID = ctx.User.ID
rel.IsTag = false
- if err = releaseservice.UpdateRelease(ctx.User, ctx.Repo.GitRepo, rel, attachmentUUIDs); err != nil {
+ if err = releaseservice.UpdateReleaseOrCreatReleaseFromTag(ctx.User, ctx.Repo.GitRepo, rel, attachmentUUIDs, true); err != nil {
ctx.Data["Err_TagName"] = true
- ctx.ServerError("UpdateRelease", err)
+ ctx.ServerError("UpdateReleaseOrCreatReleaseFromTag", err)
return
}
}
@@ -341,7 +341,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 = releaseservice.UpdateRelease(ctx.User, ctx.Repo.GitRepo, rel, attachmentUUIDs); err != nil {
+ if err = releaseservice.UpdateReleaseOrCreatReleaseFromTag(ctx.User, ctx.Repo.GitRepo, rel, attachmentUUIDs, false); err != nil {
ctx.ServerError("UpdateRelease", err)
return
}