Renamed modpol/modpol directory to modpol_core for clarity and consistency
This commit is contained in:
39
modpol_core/modules/join_org.lua
Normal file
39
modpol_core/modules/join_org.lua
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
join_org = {}
|
||||
|
||||
join_org.setup = {
|
||||
name = "Join Org",
|
||||
slug = "join_org",
|
||||
desc = "If consent process is passed, initiator joins this org."
|
||||
}
|
||||
|
||||
function join_org.initiate(initiator, org, result)
|
||||
modpol.interactions.binary_poll_user(
|
||||
initiator,
|
||||
"Would you like to join " .. org.name,
|
||||
function (resp)
|
||||
if resp == "Yes" then
|
||||
org:add_member(initiator)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
for i, member in ipairs(org.members) do
|
||||
org:add_pending_action(
|
||||
member,
|
||||
function ()
|
||||
modpol.interactions.binary_poll_user(
|
||||
member,
|
||||
"Let " .. initiator .. " join " .. org.name .. "?",
|
||||
function (resp)
|
||||
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
if result then result() end
|
||||
end
|
||||
|
||||
modpol.modules.join_org = join_org
|
Reference in New Issue
Block a user