mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-22 20:00:03 +02:00
Move unit into models/unit/ (#17576)
* Move unit into models/unit/ * Rename unit.UnitType as unit.Type
This commit is contained in:
parent
b6b1e71665
commit
99b2858e62
68 changed files with 556 additions and 491 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue