Add setting to set default and global disabled repository units. (#8788)
* Add possibility to global disable repo units. * Add Default Repo Unit app.ini setting. * Hide units * Hide disabled repo units * Minor fixes * Indicate disabled units in team settings. Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:

committed by
Lauris BH

parent
36943e56d6
commit
3c07d03c03
@ -170,5 +170,16 @@ func (r *RepoUnit) ExternalTrackerConfig() *ExternalTrackerConfig {
|
||||
}
|
||||
|
||||
func getUnitsByRepoID(e Engine, repoID int64) (units []*RepoUnit, err error) {
|
||||
return units, e.Where("repo_id = ?", repoID).Find(&units)
|
||||
var tmpUnits []*RepoUnit
|
||||
if err := e.Where("repo_id = ?", repoID).Find(&tmpUnits); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, u := range tmpUnits {
|
||||
if !u.Type.UnitGlobalDisabled() {
|
||||
units = append(units, u)
|
||||
}
|
||||
}
|
||||
|
||||
return units, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user