From 3c54a1dbf62e56d948feb1008512900140033737 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Fri, 2 Feb 2024 17:37:37 +0800 Subject: [PATCH] Avoid sending update/delete release notice when it is draft (#29008) (#29025) Backport #29008 by @yp05327 Fix #27157 Co-authored-by: yp05327 <576951401@qq.com> (cherry picked from commit 8def405047f003f680be92241ad4db3d1eb88a64) --- services/release/release.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/services/release/release.go b/services/release/release.go index 29fc7a617a..01a52e9d00 100644 --- a/services/release/release.go +++ b/services/release/release.go @@ -278,15 +278,13 @@ func UpdateRelease(ctx context.Context, doer *user_model.User, gitRepo *git.Repo } } - if !isCreated { - notify_service.UpdateRelease(gitRepo.Ctx, doer, rel) - return nil - } - if !rel.IsDraft { + if !isCreated { + notify_service.UpdateRelease(gitRepo.Ctx, doer, rel) + return nil + } notify_service.NewRelease(gitRepo.Ctx, rel) } - return nil } @@ -351,7 +349,8 @@ func DeleteReleaseByID(ctx context.Context, repo *repo_model.Repository, rel *re } } - notify_service.DeleteRelease(ctx, doer, rel) - + if !rel.IsDraft { + notify_service.DeleteRelease(ctx, doer, rel) + } return nil }