diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-10 03:57:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-09 20:57:58 +0100 |
commit | 99b2858e628d92bba252be72def409af77af735b (patch) | |
tree | 56159cf10b271307911e6f01626c0c3efba789ab /modules/context/context.go | |
parent | b6b1e716654fec3b16d245ef65cf42e57e1bb5b6 (diff) | |
download | gitea-99b2858e628d92bba252be72def409af77af735b.tar.gz gitea-99b2858e628d92bba252be72def409af77af735b.zip |
Move unit into models/unit/ (#17576)
* Move unit into models/unit/
* Rename unit.UnitType as unit.Type
Diffstat (limited to 'modules/context/context.go')
-rw-r--r-- | modules/context/context.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/context/context.go b/modules/context/context.go index f652d3845a..cb7131907e 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -21,6 +21,7 @@ import ( "time" "code.gitea.io/gitea/models" + "code.gitea.io/gitea/models/unit" "code.gitea.io/gitea/modules/base" mc "code.gitea.io/gitea/modules/cache" "code.gitea.io/gitea/modules/json" @@ -90,7 +91,7 @@ func (ctx *Context) IsUserRepoAdmin() bool { } // IsUserRepoWriter returns true if current user has write privilege in current repo -func (ctx *Context) IsUserRepoWriter(unitTypes []models.UnitType) bool { +func (ctx *Context) IsUserRepoWriter(unitTypes []unit.Type) bool { for _, unitType := range unitTypes { if ctx.Repo.CanWrite(unitType) { return true @@ -101,7 +102,7 @@ func (ctx *Context) IsUserRepoWriter(unitTypes []models.UnitType) bool { } // IsUserRepoReaderSpecific returns true if current user can read current repo's specific part -func (ctx *Context) IsUserRepoReaderSpecific(unitType models.UnitType) bool { +func (ctx *Context) IsUserRepoReaderSpecific(unitType unit.Type) bool { return ctx.Repo.CanRead(unitType) } @@ -733,10 +734,10 @@ func Contexter() func(next http.Handler) http.Handler { ctx.Data["ManifestData"] = setting.ManifestData - ctx.Data["UnitWikiGlobalDisabled"] = models.UnitTypeWiki.UnitGlobalDisabled() - ctx.Data["UnitIssuesGlobalDisabled"] = models.UnitTypeIssues.UnitGlobalDisabled() - ctx.Data["UnitPullsGlobalDisabled"] = models.UnitTypePullRequests.UnitGlobalDisabled() - ctx.Data["UnitProjectsGlobalDisabled"] = models.UnitTypeProjects.UnitGlobalDisabled() + ctx.Data["UnitWikiGlobalDisabled"] = unit.TypeWiki.UnitGlobalDisabled() + ctx.Data["UnitIssuesGlobalDisabled"] = unit.TypeIssues.UnitGlobalDisabled() + ctx.Data["UnitPullsGlobalDisabled"] = unit.TypePullRequests.UnitGlobalDisabled() + ctx.Data["UnitProjectsGlobalDisabled"] = unit.TypeProjects.UnitGlobalDisabled() ctx.Data["i18n"] = locale ctx.Data["Tr"] = i18n.Tr |