aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/wiki.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/repo/wiki.go')
-rw-r--r--routers/web/repo/wiki.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/routers/web/repo/wiki.go b/routers/web/repo/wiki.go
index a571c46fd7..16927de2e9 100644
--- a/routers/web/repo/wiki.go
+++ b/routers/web/repo/wiki.go
@@ -15,6 +15,7 @@ import (
"strings"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
@@ -40,14 +41,14 @@ const (
// MustEnableWiki check if wiki is enabled, if external then redirect
func MustEnableWiki(ctx *context.Context) {
- if !ctx.Repo.CanRead(models.UnitTypeWiki) &&
- !ctx.Repo.CanRead(models.UnitTypeExternalWiki) {
+ if !ctx.Repo.CanRead(unit.TypeWiki) &&
+ !ctx.Repo.CanRead(unit.TypeExternalWiki) {
if log.IsTrace() {
log.Trace("Permission Denied: User %-v cannot read %-v or %-v of repo %-v\n"+
"User in repo has Permissions: %-+v",
ctx.User,
- models.UnitTypeWiki,
- models.UnitTypeExternalWiki,
+ unit.TypeWiki,
+ unit.TypeExternalWiki,
ctx.Repo.Repository,
ctx.Repo.Permission)
}
@@ -55,7 +56,7 @@ func MustEnableWiki(ctx *context.Context) {
return
}
- unit, err := ctx.Repo.Repository.GetUnit(models.UnitTypeExternalWiki)
+ unit, err := ctx.Repo.Repository.GetUnit(unit.TypeExternalWiki)
if err == nil {
ctx.Redirect(unit.ExternalWikiConfig().ExternalWikiURL)
return
@@ -380,7 +381,7 @@ func renderEditPage(ctx *context.Context) {
// Wiki renders single wiki page
func Wiki(ctx *context.Context) {
ctx.Data["PageIsWiki"] = true
- ctx.Data["CanWriteWiki"] = ctx.Repo.CanWrite(models.UnitTypeWiki) && !ctx.Repo.Repository.IsArchived
+ ctx.Data["CanWriteWiki"] = ctx.Repo.CanWrite(unit.TypeWiki) && !ctx.Repo.Repository.IsArchived
if !ctx.Repo.Repository.HasWiki() {
ctx.Data["Title"] = ctx.Tr("repo.wiki")
@@ -422,7 +423,7 @@ func Wiki(ctx *context.Context) {
// WikiRevision renders file revision list of wiki page
func WikiRevision(ctx *context.Context) {
ctx.Data["PageIsWiki"] = true
- ctx.Data["CanWriteWiki"] = ctx.Repo.CanWrite(models.UnitTypeWiki) && !ctx.Repo.Repository.IsArchived
+ ctx.Data["CanWriteWiki"] = ctx.Repo.CanWrite(unit.TypeWiki) && !ctx.Repo.Repository.IsArchived
if !ctx.Repo.Repository.HasWiki() {
ctx.Data["Title"] = ctx.Tr("repo.wiki")
@@ -467,7 +468,7 @@ func WikiPages(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.wiki.pages")
ctx.Data["PageIsWiki"] = true
- ctx.Data["CanWriteWiki"] = ctx.Repo.CanWrite(models.UnitTypeWiki) && !ctx.Repo.Repository.IsArchived
+ ctx.Data["CanWriteWiki"] = ctx.Repo.CanWrite(unit.TypeWiki) && !ctx.Repo.Repository.IsArchived
wikiRepo, commit, err := findWikiRepoCommit(ctx)
if err != nil {