]> source.dussan.org Git - gitea.git/commitdiff
Do not send notifications for draft releases (#21451)
authorKN4CK3R <admin@oldschoolhack.me>
Mon, 17 Oct 2022 21:33:27 +0000 (23:33 +0200)
committerGitHub <noreply@github.com>
Mon, 17 Oct 2022 21:33:27 +0000 (17:33 -0400)
Fixes #21448

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
services/release/release.go

index 187ebeb486d66d2a03ad3d51e2c2ee8255f5ce62..af1b0752320809df4a6942157f9eff13e102a318 100644 (file)
@@ -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
@@ -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
 }