functional test of call_module and new pending action/interact version

This commit is contained in:
Luke Miller
2021-12-06 16:45:52 -05:00
parent 08151ad9d9
commit fa7a0f82f6
5 changed files with 75 additions and 61 deletions
+48
View File
@@ -0,0 +1,48 @@
--[[
modpol calls this function when someone starts a new request for this module
--]]
function module:initiate(org) {
form = {
{
"name": "to_remove",
"display": "Which user should be removed?",
"type": "drop-down",
"values": org:list_members()
},
{
"name": "reason",
"type": "text-box",
"prompt": "Reason for removing member:"
}
}
return form
}
--[[
modpol prompts the user with this form, and after receiving the data asynchronously
the returned form would look like:
{
"to_remove": luke,
"reason": stealing food
}
based on provided "name" fields and the input given by the user
now module:request is called
--]]
function module:request(form) {
self.data = form
}
--[[
after the module request function runs, modpol will initiate the consent process
if consent is approved, the implement function is called
--]]
function module:implement() {
org:remove_member(self.data.to_remove)
}