Various bugfixes on defer and processes

This commit is contained in:
Nathan Schneider 2022-08-17 17:24:53 -06:00
parent df20cc835b
commit 838a017f14
4 changed files with 11 additions and 6 deletions

View File

@ -44,6 +44,7 @@ function add_child_org:initiate(result)
self.initiator,
"Proposed child org: " .. input)
-- initiate consent process
self.data.result = result
self:call_module(
self.config.approval_module,
self.initiator,

View File

@ -43,7 +43,6 @@ function defer:initiate(result)
end
modpol.interactions.org_dashboard(
self.initiator, self.org.id)
if result then result() end
self.org:delete_process(self.id)
end

View File

@ -3,9 +3,9 @@
-- @module join_org
local join_org = {
name = "Join this org (consent)",
name = "Join this org",
slug = "join_org",
desc = "Adds member with consent of all members"
desc = "Allows initiator to join this org"
}
join_org.data = {

View File

@ -8,13 +8,18 @@
-- @param config Config for module
-- @param result
function modpol.orgs:call_module(module_slug, initiator, config, result, parent_id)
if not module_slug then -- if slug is false then simply run result
-- first, if no slug, just run result
-- may not be necessary if we use false as default approval_module
if not module_slug
and result() then
result()
return
end
-- if module doesn't exist, abort
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 "' .. tostring(module_slug) .. '" not found')
return
end