diff options
author | David Schneiderbauer <daviian@users.noreply.github.com> | 2018-06-21 18:00:13 +0200 |
---|---|---|
committer | techknowlogick <techknowlogick@users.noreply.github.com> | 2018-06-21 12:00:13 -0400 |
commit | 0b3ea428477b9da33f40252e79aafe85b09526f3 (patch) | |
tree | 4fccc7dbf7f027331735d7d041bc290db632b744 /models/repo_watch.go | |
parent | 46d19c4676efe5201c5de790bcb963bfc93a95c7 (diff) | |
download | gitea-0b3ea428477b9da33f40252e79aafe85b09526f3.tar.gz gitea-0b3ea428477b9da33f40252e79aafe85b09526f3.zip |
hide issues from org private repos w/o team assignment (#4034)
Diffstat (limited to 'models/repo_watch.go')
-rw-r--r-- | models/repo_watch.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/models/repo_watch.go b/models/repo_watch.go index fb89a55a11..8019027c1e 100644 --- a/models/repo_watch.go +++ b/models/repo_watch.go @@ -109,6 +109,23 @@ func notifyWatchers(e Engine, act *Action) error { act.ID = 0 act.UserID = watches[i].UserID + act.Repo.Units = nil + + switch act.OpType { + case ActionCommitRepo, ActionPushTag, ActionDeleteTag, ActionDeleteBranch: + if !act.Repo.CheckUnitUser(act.UserID, false, UnitTypeCode) { + continue + } + case ActionCreateIssue, ActionCommentIssue, ActionCloseIssue, ActionReopenIssue: + if !act.Repo.CheckUnitUser(act.UserID, false, UnitTypeIssues) { + continue + } + case ActionCreatePullRequest, ActionMergePullRequest, ActionClosePullRequest, ActionReopenPullRequest: + if !act.Repo.CheckUnitUser(act.UserID, false, UnitTypePullRequests) { + continue + } + } + if _, err = e.InsertOne(act); err != nil { return fmt.Errorf("insert new action: %v", err) } |