From 99b2858e628d92bba252be72def409af77af735b Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 10 Nov 2021 03:57:58 +0800 Subject: Move unit into models/unit/ (#17576) * Move unit into models/unit/ * Rename unit.UnitType as unit.Type --- routers/web/repo/http.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'routers/web/repo/http.go') diff --git a/routers/web/repo/http.go b/routers/web/repo/http.go index 162338a959..7c5dcd42be 100644 --- a/routers/web/repo/http.go +++ b/routers/web/repo/http.go @@ -22,6 +22,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/login" + "code.gitea.io/gitea/models/unit" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" @@ -99,11 +100,11 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { } isWiki := false - var unitType = models.UnitTypeCode + var unitType = unit.TypeCode var wikiRepoName string if strings.HasSuffix(reponame, ".wiki") { isWiki = true - unitType = models.UnitTypeWiki + unitType = unit.TypeWiki wikiRepoName = reponame reponame = reponame[:len(reponame)-5] } @@ -270,7 +271,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { if isWiki { // Ensure the wiki is enabled before we allow access to it - if _, err := repo.GetUnit(models.UnitTypeWiki); err != nil { + if _, err := repo.GetUnit(unit.TypeWiki); err != nil { if models.IsErrUnitTypeNotExist(err) { ctx.HandleText(http.StatusForbidden, "repository wiki is disabled") return -- cgit v1.2.3