added a function to wipe all pending actions for dead processes, consent module now does this on close
This commit is contained in:
parent
295cd983b8
commit
6de2be011f
@ -44,6 +44,7 @@ end
|
|||||||
-- function to delete a process, called when process finishes
|
-- function to delete a process, called when process finishes
|
||||||
function modpol.modules.consent:delete()
|
function modpol.modules.consent:delete()
|
||||||
local process_org = modpol.orgs.get_org(self.org_id)
|
local process_org = modpol.orgs.get_org(self.org_id)
|
||||||
|
process_org:wipe_pending_actions(self.id)
|
||||||
process_org.processes[self.id] = "deleted"
|
process_org.processes[self.id] = "deleted"
|
||||||
modpol.ocutil.log('Deleted process #' .. self.id)
|
modpol.ocutil.log('Deleted process #' .. self.id)
|
||||||
end
|
end
|
||||||
@ -90,8 +91,4 @@ function modpol.modules.consent:update_status()
|
|||||||
else
|
else
|
||||||
modpol.ocutil.log('Waiting for more votes...')
|
modpol.ocutil.log('Waiting for more votes...')
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
function modpol.modules.consent.pending_processes()
|
|
||||||
|
|
||||||
end
|
end
|
@ -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)
|
modpol.ocutil.log("Could not remove pending action '" .. action .. "' from " .. user .. " in process #" .. process_id)
|
||||||
end
|
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
|
-- compares to requests to see if they are identical
|
||||||
|
Loading…
x
Reference in New Issue
Block a user