Reverting
This commit is contained in:
@@ -8,6 +8,11 @@
|
|||||||
-- @param config Config for module
|
-- @param config Config for module
|
||||||
-- @param result
|
-- @param result
|
||||||
function modpol.orgs:call_module(module_slug, initiator, config, result, parent_id)
|
function modpol.orgs:call_module(module_slug, initiator, config, result, parent_id)
|
||||||
|
if not module_slug then -- if false then simply run result
|
||||||
|
result()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if not modpol.modules[module_slug] then
|
if not modpol.modules[module_slug] then
|
||||||
modpol.ocutil.log('Error in ' .. self.name .. ':call_module -> module "' .. module_slug .. '" not found')
|
modpol.ocutil.log('Error in ' .. self.name .. ':call_module -> module "' .. module_slug .. '" not found')
|
||||||
return
|
return
|
||||||
@@ -64,34 +69,6 @@ function modpol.orgs:call_module(module_slug, initiator, config, result, parent_
|
|||||||
return index
|
return index
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Generic approval check for modules, able to call other modules
|
|
||||||
-- @function modpol.orgs.approve
|
|
||||||
-- @param approval_module Slug of module used to approve, or nil
|
|
||||||
-- @param process The parent process of which this is part
|
|
||||||
-- @param config Config for module
|
|
||||||
-- @param result Function for what gets done if approved
|
|
||||||
function modpol.orgs:approve(approval_module, process, config, result)
|
|
||||||
if not approval_module then -- if nil then simply approve
|
|
||||||
result()
|
|
||||||
return
|
|
||||||
elseif not modpol.modules[approval_module] then
|
|
||||||
modpol.interactions.message(
|
|
||||||
process.initiator,
|
|
||||||
"Approval process failed: module " .. approval_module
|
|
||||||
.. " does not exist.")
|
|
||||||
modpol.interactions.org_dashboard(
|
|
||||||
process.initiator, process.org.id)
|
|
||||||
process.org:delete_process(process.id)
|
|
||||||
return
|
|
||||||
else
|
|
||||||
-- call module
|
|
||||||
modpol.orgs:call_module(
|
|
||||||
approval_module,
|
|
||||||
process.initiator,
|
|
||||||
config,
|
|
||||||
result, process.id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--- Get the root process of the given id
|
--- Get the root process of the given id
|
||||||
|
Reference in New Issue
Block a user