From d61ab632f1119c57a25912a1d089a1ab2ce345f5 Mon Sep 17 00:00:00 2001 From: nazoking Date: Mon, 23 May 2016 15:31:39 +0900 Subject: [PATCH] fix #1192 Cannot disable option "Require status checks to pass before merging" --- .../core/api/ApiBranchProtection.scala | 3 +- .../core/settings/branchprotection.scala.html | 34 +++++++++++-------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/main/scala/gitbucket/core/api/ApiBranchProtection.scala b/src/main/scala/gitbucket/core/api/ApiBranchProtection.scala index 6554e0812..dc452ebb2 100644 --- a/src/main/scala/gitbucket/core/api/ApiBranchProtection.scala +++ b/src/main/scala/gitbucket/core/api/ApiBranchProtection.scala @@ -14,7 +14,7 @@ object ApiBranchProtection{ 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 @@ object ApiBranchProtection{ } )) } - diff --git a/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html b/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html index 083375736..fb57d92d2 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 @@