We should call `notify_service.NewRelease` when a release is created from an existing tag. Co-authored-by: Zettat123 <zettat123@gmail.com>
This commit is contained in:
parent
cb52eb639e
commit
0c9dcda10d
|
@ -204,7 +204,7 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo
|
||||||
if rel.ID == 0 {
|
if rel.ID == 0 {
|
||||||
return errors.New("UpdateRelease only accepts an exist release")
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -216,6 +216,12 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo
|
||||||
}
|
}
|
||||||
defer committer.Close()
|
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 {
|
if err = repo_model.UpdateRelease(ctx, rel); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -292,7 +298,7 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo
|
||||||
}
|
}
|
||||||
|
|
||||||
if !rel.IsDraft {
|
if !rel.IsDraft {
|
||||||
if !isCreated {
|
if !isTagCreated && !isConvertedFromTag {
|
||||||
notify_service.UpdateRelease(gitRepo.Ctx, doer, rel)
|
notify_service.UpdateRelease(gitRepo.Ctx, doer, rel)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user