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
This commit is contained in:
Lauris BH 2017-10-16 16:59:01 +03:00 committed by GitHub
parent 785ba171f4
commit 13013e90f3
7 changed files with 74 additions and 42 deletions

View file

@ -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) {