2
0

join_org.lua 933 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. join_org = {}
  2. join_org.setup = {
  3. name = "Join Org",
  4. slug = "join_org",
  5. desc = "If consent process is passed, initiator joins this org."
  6. }
  7. function join_org.initiate(initiator, org, result)
  8. modpol.interactions.binary_poll_user(
  9. initiator,
  10. "Would you like to join " .. org.name,
  11. function (resp)
  12. if resp == "Yes" then
  13. org:add_member(initiator)
  14. end
  15. end
  16. )
  17. for i, member in ipairs(org.members) do
  18. org:add_pending_action(
  19. member,
  20. function ()
  21. modpol.interactions.binary_poll_user(
  22. member,
  23. "Let " .. initiator .. " join " .. org.name .. "?",
  24. function (resp)
  25. end
  26. )
  27. end
  28. )
  29. end
  30. if result then result() end
  31. end
  32. modpol.modules.join_org = join_org