summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-08-02 01:46:54 -0700
committerLauris BH <lauris@nix.lv>2017-08-02 11:46:54 +0300
commitf29458bd3a20d2d89638d5031d801c161f456374 (patch)
tree959c680d58eb5cfd82d719357759963fa7095fe6 /modules
parent539d9f4c3070abb0f024b133a4f53187a76cbcb7 (diff)
downloadgitea-f29458bd3a20d2d89638d5031d801c161f456374.tar.gz
gitea-f29458bd3a20d2d89638d5031d801c161f456374.zip
EnableUnit() -> UnitEnabled() (#2242)
Diffstat (limited to 'modules')
-rw-r--r--modules/context/repo.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 3dface7da7..897cd3ca1a 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -523,14 +523,7 @@ func LoadRepoUnits() macaron.Handler {
// CheckUnit will check whether
func CheckUnit(unitType models.UnitType) macaron.Handler {
return func(ctx *Context) {
- var find bool
- for _, unit := range ctx.Repo.Repository.Units {
- if unit.Type == unitType {
- find = true
- break
- }
- }
- if !find {
+ if !ctx.Repo.Repository.UnitEnabled(unitType) {
ctx.Handle(404, "CheckUnit", fmt.Errorf("%s: %v", ctx.Tr("units.error.unit_not_allowed"), unitType))
}
}