From 62cd7f89bc18f43f118072bcbe9393a2bd5a87ac Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Fri, 2 Feb 2024 13:18:12 +0900 Subject: [PATCH] Avoid sending update/delete release notice when it is draft (#29008) Fix #27157 --- 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 29fc7a617a3c..01a52e9d0085 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 }