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.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.go')
-rw-r--r-- | models/repo.go | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/models/repo.go b/models/repo.go index 7f2be502a4..d1cc290c44 100644 --- a/models/repo.go +++ b/models/repo.go @@ -365,22 +365,14 @@ func (repo *Repository) getUnitsByUserID(e Engine, userID int64, isAdmin bool) ( return err } - var allTypes = make(map[UnitType]struct{}, len(allRepUnitTypes)) - for _, team := range teams { - // Administrators can not be limited - if team.Authorize >= AccessModeAdmin { - return nil - } - for _, unitType := range team.UnitTypes { - allTypes[unitType] = struct{}{} - } - } - // unique var newRepoUnits = make([]*RepoUnit, 0, len(repo.Units)) for _, u := range repo.Units { - if _, ok := allTypes[u.Type]; ok { - newRepoUnits = append(newRepoUnits, u) + for _, team := range teams { + if team.UnitEnabled(u.Type) { + newRepoUnits = append(newRepoUnits, u) + break + } } } |