mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-17 23:00:02 +02:00
hide issues from org private repos w/o team assignment (#4034)
This commit is contained in:
parent
46d19c4676
commit
0b3ea42847
24 changed files with 545 additions and 72 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue