summaryrefslogtreecommitdiffstats
path: root/routers/repo/wiki.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-02-04 23:53:46 +0800
committerGitHub <noreply@github.com>2017-02-04 23:53:46 +0800
commit8a421b1fd702d99e8438f6ef6f4ee339f1eaa130 (patch)
treec69e598ca9dca29dc64a4e1d8525165ec794106f /routers/repo/wiki.go
parent49fa03bf4286bd2cbf90b271fb65d4f70e5de57f (diff)
downloadgitea-8a421b1fd702d99e8438f6ef6f4ee339f1eaa130.tar.gz
gitea-8a421b1fd702d99e8438f6ef6f4ee339f1eaa130.zip
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
Diffstat (limited to 'routers/repo/wiki.go')
-rw-r--r--routers/repo/wiki.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go
index ac979c1a9c..6e491f73a4 100644
--- a/routers/repo/wiki.go
+++ b/routers/repo/wiki.go
@@ -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
}
}