Created remove_process module---mostly works, but there are still some issues with processes and pending actions not being removed properly

This commit is contained in:
Nathan Schneider
2021-12-28 16:51:12 -07:00
parent 1b0335c069
commit 6558b7a026
5 changed files with 136 additions and 12 deletions

View File

@ -57,11 +57,14 @@ function modpol.orgs:call_module(module_slug, initiator, config, result)
end
function modpol.orgs:delete_process(id)
local msg = "Deleting "..self.processes[id].slug..
" process id "..id.." in org "..self.name
self:record(msg, self.processes[id].slug)
self:wipe_pending_actions(id)
self.processes[id] = 'deleted'
if self.processes[id]
and self.processes[id] ~= "deleted" then
local msg = "Deleting "..self.processes[id].slug..
" process id "..id.." in org "..self.name
self:record(msg, self.processes[id].slug)
self:wipe_pending_actions(id)
self.processes[id] = 'deleted'
end
end
function modpol.orgs:add_pending_action(process_id, user, callback)
@ -101,7 +104,7 @@ function modpol.orgs:interact(process_id, user)
local process = self.processes[process_id]
if self.pending[user] then
local callback = self.pending[user][process_id]
if callback then
if callback and process ~= "deleted" then
-- get data in case callback ends process
local slug = self.processes[process_id].slug
-- run callback