1
0
Fork 0
forked from forgejo/forgejo

Less naked returns (#25713)

just a step towards  #25655

and some related refactoring
This commit is contained in:
6543 2023-07-07 07:31:56 +02:00 committed by GitHub
parent b1eb1676aa
commit 8995046110
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 254 additions and 239 deletions

View file

@ -187,7 +187,7 @@ func CreateNewTag(ctx context.Context, doer *user_model.User, repo *repo_model.R
// editAttachments accept a map of attachment uuid to new attachment name which will be updated with attachments.
func UpdateRelease(doer *user_model.User, gitRepo *git.Repository, rel *repo_model.Release,
addAttachmentUUIDs, delAttachmentUUIDs []string, editAttachments map[string]string,
) (err error) {
) error {
if rel.ID == 0 {
return errors.New("UpdateRelease only accepts an exist release")
}
@ -264,8 +264,8 @@ func UpdateRelease(doer *user_model.User, gitRepo *git.Repository, rel *repo_mod
}
}
if err = committer.Commit(); err != nil {
return
if err := committer.Commit(); err != nil {
return err
}
for _, uuid := range delAttachmentUUIDs {
@ -280,14 +280,14 @@ func UpdateRelease(doer *user_model.User, gitRepo *git.Repository, rel *repo_mod
if !isCreated {
notification.NotifyUpdateRelease(gitRepo.Ctx, doer, rel)
return
return nil
}
if !rel.IsDraft {
notification.NotifyNewRelease(gitRepo.Ctx, rel)
}
return err
return nil
}
// DeleteReleaseByID deletes a release and corresponding Git tag by given ID.