mirror of
https://github.com/go-gitea/gitea
synced 2024-12-25 08:14:36 +01:00
Check if the release is converted from the tag when updating the release (#30984)
Call `notify_service.NewRelease` when a release is created from an existing tag.
This commit is contained in:
parent
d0d6aad85f
commit
fc89363832
1 changed files with 8 additions and 2 deletions
|
@ -204,7 +204,7 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo
|
|||
if rel.ID == 0 {
|
||||
return errors.New("UpdateRelease only accepts an exist release")
|
||||
}
|
||||
isCreated, err := createTag(gitRepo.Ctx, gitRepo, rel, "")
|
||||
isTagCreated, err := createTag(gitRepo.Ctx, gitRepo, rel, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -216,6 +216,12 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo
|
|||
}
|
||||
defer committer.Close()
|
||||
|
||||
oldRelease, err := repo_model.GetReleaseByID(ctx, rel.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
isConvertedFromTag := oldRelease.IsTag && !rel.IsTag
|
||||
|
||||
if err = repo_model.UpdateRelease(ctx, rel); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -292,7 +298,7 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo
|
|||
}
|
||||
|
||||
if !rel.IsDraft {
|
||||
if !isCreated {
|
||||
if !isTagCreated && !isConvertedFromTag {
|
||||
notify_service.UpdateRelease(gitRepo.Ctx, doer, rel)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue