diff --git a/src/main/scala/gitbucket/core/api/ApiBranchProtection.scala b/src/main/scala/gitbucket/core/api/ApiBranchProtection.scala index 6554e08..dc452eb 100644 --- a/src/main/scala/gitbucket/core/api/ApiBranchProtection.scala +++ b/src/main/scala/gitbucket/core/api/ApiBranchProtection.scala @@ -14,7 +14,7 @@ def apply(info: ProtectedBranchService.ProtectedBranchInfo): ApiBranchProtection = ApiBranchProtection( enabled = info.enabled, - required_status_checks = Some(Status(EnforcementLevel(info.enabled, info.includeAdministrators), info.contexts))) + required_status_checks = Some(Status(EnforcementLevel(info.enabled && info.contexts.nonEmpty, info.includeAdministrators), info.contexts))) val statusNone = Status(Off, Seq.empty) case class Status(enforcement_level: EnforcementLevel, contexts: Seq[String]) sealed class EnforcementLevel(val name: String) @@ -44,4 +44,3 @@ } )) } - diff --git a/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html b/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html index 0833757..fb57d92 100644 --- a/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html +++ b/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html @@ -26,23 +26,19 @@