mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-21 13:38:00 +02:00
Add units concept for modulable functions of a repository (#742)
* Add units concept for modulable functions of a repository * remove unused comment codes & fix lints and tests * remove unused comment codes * use struct config instead of map * fix lint * rm wrong files * fix tests
This commit is contained in:
@ -59,13 +59,15 @@ var (
|
||||
|
||||
// MustEnableIssues check if repository enable internal issues
|
||||
func MustEnableIssues(ctx *context.Context) {
|
||||
if !ctx.Repo.Repository.EnableIssues {
|
||||
if !ctx.Repo.Repository.EnableUnit(models.UnitTypeIssues) &&
|
||||
!ctx.Repo.Repository.EnableUnit(models.UnitTypeExternalTracker) {
|
||||
ctx.Handle(404, "MustEnableIssues", nil)
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.Repo.Repository.EnableExternalTracker {
|
||||
ctx.Redirect(ctx.Repo.Repository.ExternalTrackerURL)
|
||||
unit, err := ctx.Repo.Repository.GetUnit(models.UnitTypeExternalTracker)
|
||||
if err == nil {
|
||||
ctx.Redirect(unit.ExternalTrackerConfig().ExternalTrackerURL)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user