From 9fa4511e6bd9e387c62cc11d5788840e6d3bc61f Mon Sep 17 00:00:00 2001 From: John Olheiser <john.olheiser@gmail.com> Date: Fri, 24 Jun 2022 12:22:08 -0500 Subject: [PATCH] Disable status checks in template if none found (#20088) Signed-off-by: jolheiser <john.olheiser@gmail.com> --- templates/repo/settings/protected_branch.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 597567f057aa5..e7228f2ac9e15 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -127,7 +127,7 @@ <div class="field"> <div class="ui checkbox"> - <input class="enable-statuscheck" name="enable_status_check" type="checkbox" data-target="#statuscheck_contexts_box" {{if .Branch.EnableStatusCheck}}checked{{end}}> + <input class="enable-statuscheck" name="enable_status_check" type="checkbox" data-target="#statuscheck_contexts_box" {{if eq (len .branch_status_check_contexts) 0}}disabled{{end}} {{if .Branch.EnableStatusCheck}}checked{{end}}> <label>{{.i18n.Tr "repo.settings.protect_check_status_contexts"}}</label> <p class="help">{{.i18n.Tr "repo.settings.protect_check_status_contexts_desc"}}</p> </div>