adding class version of join org module

This commit is contained in:
Luke Miller
2021-11-22 16:49:03 -05:00
parent 0ca04294b7
commit db43df6ce2
4 changed files with 42 additions and 10 deletions

View File

@@ -1,25 +1,35 @@
-- JOIN ORG
-- Module that enables a user to join an org
modpol.modules.join_org = {}
module = modpol.modules.join_org
JoinOrg = {}
JoinOrg_mt = { __index = JoinOrg }
function JoinOrg:create(initiator, org)
function JoinOrg.create(initiator, org)
local inst = {
name = "Join an org",
desc = "Initiator chooses an org to become a member of. Nothing happens if they are already in an org."
desc = "Initiator chooses an org to become a member of. Nothing happens if they are already in an org.",
initiator = initiator,
org = org
}
setmetatable(inst, JoinOrg_mt)
return inst
end
function JoinOrg:initiate(initiator, org, result)
modpol.interactions.binary_poll_user(initiator, "Would you like to join", )
function JoinOrg:initiate(result)
modpol.interactions.binary_poll_user(
self.initiator,
"Would you like to join",
function (resp)
if resp == "Yes" then
self:implement()
end
end
)
if result then result() end
end
function JoinOrg:request()
@@ -33,5 +43,4 @@ end
-- ===================================
-- When calling a module internally
test = JoinOrg.create()
test:initiate("luke")
modpol.modules.join_org_class = JoinOrg