mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Disable sending email after push a commit to a closed PR (#23462)
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: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		@@ -274,9 +274,12 @@ func AddTestPullRequestTask(doer *user_model.User, repoID int64, branch string,
 | 
				
			|||||||
				continue
 | 
									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)
 | 
								AddToTaskQueue(pr)
 | 
				
			||||||
			comment, err := CreatePushPullComment(ctx, doer, pr, oldCommitID, newCommitID)
 | 
								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)
 | 
									notification.NotifyPullRequestPushCommits(ctx, doer, pr, comment)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user