mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor web routes (#30519)
Re-organize the routes in web.go and use ctx constants instead of `context.UnitTypes()` --------- Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
@@ -721,12 +721,12 @@ func checkHomeCodeViewable(ctx *context.Context) {
|
||||
}
|
||||
|
||||
var firstUnit *unit_model.Unit
|
||||
for _, repoUnit := range ctx.Repo.Units {
|
||||
if repoUnit.Type == unit_model.TypeCode {
|
||||
for _, repoUnitType := range ctx.Repo.Permission.ReadableUnitTypes() {
|
||||
if repoUnitType == unit_model.TypeCode {
|
||||
return
|
||||
}
|
||||
|
||||
unit, ok := unit_model.Units[repoUnit.Type]
|
||||
unit, ok := unit_model.Units[repoUnitType]
|
||||
if ok && (firstUnit == nil || !firstUnit.IsLessThan(unit)) {
|
||||
firstUnit = &unit
|
||||
}
|
||||
|
Reference in New Issue
Block a user