Refactor web routes (#30519)
Re-organize the routes in web.go and use ctx constants instead of `context.UnitTypes()` --------- Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
4f276a3363
commit
3e2e76e248
23 changed files with 394 additions and 377 deletions
|
@ -383,7 +383,6 @@ func repoAssignment(ctx *Context, repo *repo_model.Repository) {
|
|||
ctx.NotFound("no access right", nil)
|
||||
return
|
||||
}
|
||||
ctx.Data["HasAccess"] = true
|
||||
ctx.Data["Permission"] = &ctx.Repo.Permission
|
||||
|
||||
if repo.IsMirror {
|
||||
|
@ -1052,19 +1051,3 @@ func GitHookService() func(ctx *Context) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// UnitTypes returns a middleware to set unit types to context variables.
|
||||
func UnitTypes() func(ctx *Context) {
|
||||
return func(ctx *Context) {
|
||||
ctx.Data["UnitTypeCode"] = unit_model.TypeCode
|
||||
ctx.Data["UnitTypeIssues"] = unit_model.TypeIssues
|
||||
ctx.Data["UnitTypePullRequests"] = unit_model.TypePullRequests
|
||||
ctx.Data["UnitTypeReleases"] = unit_model.TypeReleases
|
||||
ctx.Data["UnitTypeWiki"] = unit_model.TypeWiki
|
||||
ctx.Data["UnitTypeExternalWiki"] = unit_model.TypeExternalWiki
|
||||
ctx.Data["UnitTypeExternalTracker"] = unit_model.TypeExternalTracker
|
||||
ctx.Data["UnitTypeProjects"] = unit_model.TypeProjects
|
||||
ctx.Data["UnitTypePackages"] = unit_model.TypePackages
|
||||
ctx.Data["UnitTypeActions"] = unit_model.TypeActions
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue