summaryrefslogtreecommitdiffstats
path: root/services/pull/pull.go
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-03-15 06:20:51 -0400
committerGitHub <noreply@github.com>2023-03-15 11:20:51 +0100
commitd73846f0b47874bb24053e445e7506b256ce7dcf (patch)
treec84b5a3cf15c6ed12ce290722de192b82c0b984c /services/pull/pull.go
parent527bbf67e85ea20a35269c4d700cdcb04c65aaab (diff)
downloadgitea-d73846f0b47874bb24053e445e7506b256ce7dcf.tar.gz
gitea-d73846f0b47874bb24053e445e7506b256ce7dcf.zip
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 <33891828+sillyguodong@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Diffstat (limited to 'services/pull/pull.go')
-rw-r--r--services/pull/pull.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/pull/pull.go b/services/pull/pull.go
index d8923d0d57..a5541b8460 100644
--- a/services/pull/pull.go
+++ b/services/pull/pull.go
@@ -274,9 +274,12 @@ 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 {
+ if err == nil && comment != nil && !pr.Issue.IsClosed {
notification.NotifyPullRequestPushCommits(ctx, doer, pr, comment)
}
}