Skip to content

Commit

Permalink
Do not send notifications for draft releases (#21451)
Browse files Browse the repository at this point in the history
Fixes #21448

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
  • Loading branch information
4 people authored Oct 17, 2022
1 parent c0888de commit a37e8b2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions services/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,12 @@ func UpdateRelease(doer *user_model.User, gitRepo *git.Repository, rel *repo_mod
}
}

if !isCreated {
notification.NotifyUpdateRelease(doer, rel)
return
}

if !rel.IsDraft {
notification.NotifyNewRelease(rel)
if isCreated {
notification.NotifyNewRelease(rel)
} else {
notification.NotifyUpdateRelease(doer, rel)
}
}

return err
Expand Down Expand Up @@ -353,7 +352,9 @@ func DeleteReleaseByID(ctx context.Context, id int64, doer *user_model.User, del
}
}

notification.NotifyDeleteRelease(doer, rel)
if !rel.IsDraft {
notification.NotifyDeleteRelease(doer, rel)
}

return nil
}

0 comments on commit a37e8b2

Please sign in to comment.