Major improvements on policy configuration

- Bugfixes on change_policy
- Replaced _consent modules with configurable modules
This commit is contained in:
Nathan Schneider
2022-08-09 17:00:24 -06:00
parent 78ea89559f
commit 22a2048d5a
21 changed files with 253 additions and 379 deletions

@@ -64,16 +64,24 @@ function change_policy:initiate(result)
self.org:delete_process(self.id)
return
end
local readable_value =
tostring(modpol.modules[mod_choice][policy_choice])
if readable_value == "nil" then
readable_value = "none"
end
modpol.interactions.dropdown_query(
self.initiator, "Choose a policy to change:",
policy_list,
function(policy_choice)
modpol.interactions.text_query(
self.initiator,
"Current " .. policy_choice .. " value: " ..
tostring(modpol.modules[mod_choice][policy_choice])
.. "\nChange value to (be careful!):",
"Current " .. policy_choice .. " value: "
.. readable_value
.. "\nChange value to (or leave blank):",
function(policy_input)
if policy_input == "" then
policy_input = false
end
self:approve_change(
mod_choice,
policy_choice,
@@ -94,7 +102,7 @@ end
-- @param input (string) input content
function change_policy:approve_change(module_slug, policy, input)
self.org:call_module(
approval_module,
self.config.approval_module,
self.initiator,
{prompt = "Update " .. policy .. " policy on module " ..
module_slug .. " with: " .. input .. " ?"},