mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Add units to team (#947)
* add units to team * fix lint * finish team setting backend * finished permission controll on routes * fix import blank line * add unit check on ssh/http pull and push and fix test failed * fix fixtures data * remove unused code
This commit is contained in:
@@ -252,6 +252,25 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
|
||||
|
||||
// Home render repository home page
|
||||
func Home(ctx *context.Context) {
|
||||
if len(ctx.Repo.Repository.Units) > 0 {
|
||||
tp := ctx.Repo.Repository.Units[0].Type
|
||||
if tp == models.UnitTypeCode {
|
||||
renderCode(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
unit, ok := models.Units[tp]
|
||||
if ok {
|
||||
ctx.Redirect(setting.AppSubURL + fmt.Sprintf("/%s%s",
|
||||
ctx.Repo.Repository.FullName(), unit.URI))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ctx.Handle(404, "Home", fmt.Errorf(ctx.Tr("units.error.no_unit_allowed_repo")))
|
||||
}
|
||||
|
||||
func renderCode(ctx *context.Context) {
|
||||
ctx.Data["PageIsViewCode"] = true
|
||||
|
||||
if ctx.Repo.Repository.IsBare {
|
||||
|
Reference in New Issue
Block a user