diff options
author | 赵智超 <1012112796@qq.com> | 2020-09-16 07:49:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-15 19:49:34 -0400 |
commit | ec5677b7a2f56e124eaaa53291e21d6260354c12 (patch) | |
tree | c2b51f68e6a21301c4d497419d06d627172448ec /models/notification.go | |
parent | 07995e23018b5aa3906884f3c80ea5181250121e (diff) | |
download | gitea-ec5677b7a2f56e124eaaa53291e21d6260354c12.tar.gz gitea-ec5677b7a2f56e124eaaa53291e21d6260354c12.zip |
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>
Diffstat (limited to 'models/notification.go')
-rw-r--r-- | models/notification.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/models/notification.go b/models/notification.go index 9258b68f22..80d837078a 100644 --- a/models/notification.go +++ b/models/notification.go @@ -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 } |