added a function to wipe all pending actions for dead processes, consent module now does this on close

This commit is contained in:
Luke Miller 2021-06-14 17:21:13 -04:00
parent 295cd983b8
commit 6de2be011f
2 changed files with 9 additions and 4 deletions

View File

@ -44,6 +44,7 @@ end
-- function to delete a process, called when process finishes
function modpol.modules.consent:delete()
local process_org = modpol.orgs.get_org(self.org_id)
process_org:wipe_pending_actions(self.id)
process_org.processes[self.id] = "deleted"
modpol.ocutil.log('Deleted process #' .. self.id)
end
@ -90,8 +91,4 @@ function modpol.modules.consent:update_status()
else
modpol.ocutil.log('Waiting for more votes...')
end
end
function modpol.modules.consent.pending_processes()
end

View File

@ -67,6 +67,14 @@ function modpol.orgs:remove_pending_action(process_id, user, action)
modpol.ocutil.log("Could not remove pending action '" .. action .. "' from " .. user .. " in process #" .. process_id)
end
-- =====================
-- removes all pending actions for a given process id from all users
function modpol.orgs:wipe_pending_actions(process_id)
for user in pairs(self.pending) do
self.pending[user][process_id] = nil
end
modpol.ocutil.log("Removed all pending actions for process #" .. process_id)
end
-- ===========================
-- compares to requests to see if they are identical