forked from forgejo/forgejo
Add units concept for modulable functions of a repository (#742)
* Add units concept for modulable functions of a repository * remove unused comment codes & fix lints and tests * remove unused comment codes * use struct config instead of map * fix lint * rm wrong files * fix tests
This commit is contained in:
parent
49fa03bf42
commit
8a421b1fd7
16 changed files with 668 additions and 89 deletions
|
@ -27,13 +27,15 @@ const (
|
|||
|
||||
// MustEnableWiki check if wiki is enabled, if external then redirect
|
||||
func MustEnableWiki(ctx *context.Context) {
|
||||
if !ctx.Repo.Repository.EnableWiki {
|
||||
if !ctx.Repo.Repository.EnableUnit(models.UnitTypeWiki) &&
|
||||
!ctx.Repo.Repository.EnableUnit(models.UnitTypeExternalWiki) {
|
||||
ctx.Handle(404, "MustEnableWiki", nil)
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.Repo.Repository.EnableExternalWiki {
|
||||
ctx.Redirect(ctx.Repo.Repository.ExternalWikiURL)
|
||||
unit, err := ctx.Repo.Repository.GetUnit(models.UnitTypeExternalWiki)
|
||||
if err == nil {
|
||||
ctx.Redirect(unit.ExternalWikiConfig().ExternalWikiURL)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue