# HG changeset patch # User bsw # Date 1632740876 -7200 # Node ID 9b8dc1828f1f0a0004b1389db0725edd6702675f # Parent 26b0b4fb09fe36a4394551f57218c6359fc728d0 If only one policy is available, choose it automatically diff -r 26b0b4fb09fe -r 9b8dc1828f1f app/main/draft/new.lua --- a/app/main/draft/new.lua Mon Sep 27 13:03:36 2021 +0200 +++ b/app/main/draft/new.lua Mon Sep 27 13:07:56 2021 +0200 @@ -253,14 +253,21 @@ tmp[#tmp+1] = allowed_policy end end - ui.container{ content = _"Please choose a policy for the new issue:" } - ui.field.select{ - name = "policy_id", - foreign_records = tmp, - foreign_id = "id", - foreign_name = "name", - value = param.get("policy_id", atom.integer) or area.default_policy and area.default_policy.id - } + if #area.allowed_policies > 1 then + ui.container{ content = _"Please choose a policy for the new issue:" } + ui.field.select{ + name = "policy_id", + foreign_records = tmp, + foreign_id = "id", + foreign_name = "name", + value = param.get("policy_id", atom.integer) or area.default_policy and area.default_policy.id + } + else + ui.field.hidden{ + name = "policy_id", + value = area.allowed_policies[1].id + } + end if policy and policy.free_timeable then local available_timings if config.free_timing and config.free_timing.available_func then