Skip to content

Commit d73846f

Browse files
GiteaBotsillyguodonglunnyKN4CK3R
authored
Disable sending email after push a commit to a closed PR (#23462) (#23492)
Backport #23462 by @sillyguodong Close #23440 Cause by #23189 In #23189, we should insert a comment record into db when pushing a commit to the PR, even if the PR is closed. But should skip sending any notification in this case. Co-authored-by: sillyguodong <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: KN4CK3R <[email protected]>
1 parent 527bbf6 commit d73846f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: services/pull/pull.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,12 @@ func AddTestPullRequestTask(doer *user_model.User, repoID int64, branch string,
274274
continue
275275
}
276276

277+
// If the PR is closed, someone still push some commits to the PR,
278+
// 1. We will insert comments of commits, but hidden until the PR is reopened.
279+
// 2. We won't send any notification.
277280
AddToTaskQueue(pr)
278281
comment, err := CreatePushPullComment(ctx, doer, pr, oldCommitID, newCommitID)
279-
if err == nil && comment != nil {
282+
if err == nil && comment != nil && !pr.Issue.IsClosed {
280283
notification.NotifyPullRequestPushCommits(ctx, doer, pr, comment)
281284
}
282285
}

0 commit comments

Comments
 (0)