diff options
author | Lauris BH <lauris@nix.lv> | 2017-10-16 16:59:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-16 16:59:01 +0300 |
commit | 13013e90f39d30fd0882839783e2f7bbd8a5df25 (patch) | |
tree | e8c31b45cd9571daab0ac0e247c55d8b8c835dcc /modules/context/repo.go | |
parent | 785ba171f4db76da17bc0ce7ceeaf2983664fc1f (diff) | |
download | gitea-13013e90f39d30fd0882839783e2f7bbd8a5df25.tar.gz gitea-13013e90f39d30fd0882839783e2f7bbd8a5df25.zip |
Fix PR, milestone and label functionality if issue unit is disabled (#2710) (#2714)
* Fix PR, milestone and label functionality if issue unit is disabled or not assigned to user
* Fix multi-actions in PR page
* Change error message
* Fix comment update and delete functionality in PR
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r-- | modules/context/repo.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index aad408d18f..cdb021f713 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -614,6 +614,15 @@ func CheckUnit(unitType models.UnitType) macaron.Handler { } } +// CheckAnyUnit will check whether any of the unit types are enabled +func CheckAnyUnit(unitTypes ...models.UnitType) macaron.Handler { + return func(ctx *Context) { + if !ctx.Repo.Repository.AnyUnitEnabled(unitTypes...) { + ctx.Handle(404, "CheckAnyUnit", fmt.Errorf("%s: %v", ctx.Tr("units.error.unit_not_allowed"), unitTypes)) + } + } +} + // GitHookService checks if repository Git hooks service has been enabled. func GitHookService() macaron.Handler { return func(ctx *Context) { |