forked from kevadesu/forgejo
[GITEA] repo: Don't redirect the repo to external units
When displaying the repo home view, do not redirect to unit types that can't be defaults (which, at the moment, are the external wiki and issue tracker unit types). If we'd redirect to those, that would mean that a repository with the Code unit disabled, and an external issue tracker would immediately redirect to the external issue tracker, making it harder to reach other, non-external units of the repo. Fixes #1965. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu> (cherry picked from commit44078e5460
) (cherry picked from commit1868dec2e4
) (cherry picked from commitc3a8e98870
)
This commit is contained in:
parent
7a343877f1
commit
9266b1916f
2 changed files with 104 additions and 1 deletions
|
@ -732,7 +732,7 @@ func checkHomeCodeViewable(ctx *context.Context) {
|
|||
}
|
||||
|
||||
unit, ok := unit_model.Units[repoUnit.Type]
|
||||
if ok && (firstUnit == nil || !firstUnit.IsLessThan(unit)) {
|
||||
if ok && (firstUnit == nil || !firstUnit.IsLessThan(unit)) && repoUnit.Type.CanBeDefault() {
|
||||
firstUnit = &unit
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue