Browse Source

Various bugfixes on defer and processes

Nathan Schneider 1 year ago
parent
commit
838a017f14

+ 1 - 0
modpol_core/modules/add_child_org.lua

@@ -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, 

+ 0 - 1
modpol_core/modules/defer.lua

@@ -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
 

+ 2 - 2
modpol_core/modules/join_org.lua

@@ -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 = {

+ 8 - 3
modpol_core/orgs/process.lua

@@ -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