From a737a9c70661f50d84945e8380f191bf33137e5c Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Tue, 14 Mar 2023 13:48:04 +0800 Subject: [PATCH 1/2] disbale send email when pr is closed --- services/pull/pull.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/pull/pull.go b/services/pull/pull.go index e40e59a2c5002..4b2f2fc950d63 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -276,7 +276,7 @@ func AddTestPullRequestTask(doer *user_model.User, repoID int64, branch string, AddToTaskQueue(pr) comment, err := CreatePushPullComment(ctx, doer, pr, oldCommitID, newCommitID) - if err == nil && comment != nil { + if err == nil && comment != nil && !pr.Issue.IsClosed { notification.NotifyPullRequestPushCommits(ctx, doer, pr, comment) } } From 66f84ee76957e10ff40eba4199cec00aa08a2204 Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Tue, 14 Mar 2023 18:46:08 +0800 Subject: [PATCH 2/2] add comment --- services/pull/pull.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/pull/pull.go b/services/pull/pull.go index 4b2f2fc950d63..e1d5a6f86dd42 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -274,6 +274,9 @@ func AddTestPullRequestTask(doer *user_model.User, repoID int64, branch string, continue } + // If the PR is closed, someone still push some commits to the PR, + // 1. We will insert comments of commits, but hidden until the PR is reopened. + // 2. We won't send any notification. AddToTaskQueue(pr) comment, err := CreatePushPullComment(ctx, doer, pr, oldCommitID, newCommitID) if err == nil && comment != nil && !pr.Issue.IsClosed {