mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Simplify CheckUnitUser logic (#12854)
if check one user's unit in different repos, it's not necessary to get user data every time. Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
		@@ -199,10 +199,18 @@ func createOrUpdateIssueNotifications(e Engine, issueID, commentID, notification
 | 
			
		||||
	// notify
 | 
			
		||||
	for userID := range toNotify {
 | 
			
		||||
		issue.Repo.Units = nil
 | 
			
		||||
		if issue.IsPull && !issue.Repo.checkUnitUser(e, userID, false, UnitTypePullRequests) {
 | 
			
		||||
		user, err := getUserByID(e, userID)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			if IsErrUserNotExist(err) {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		if issue.IsPull && !issue.Repo.checkUnitUser(e, user, UnitTypePullRequests) {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		if !issue.IsPull && !issue.Repo.checkUnitUser(e, userID, false, UnitTypeIssues) {
 | 
			
		||||
		if !issue.IsPull && !issue.Repo.checkUnitUser(e, user, UnitTypeIssues) {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user