remove_org_consent.lua 997 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --- Remove org (consent)
  2. -- A simple module that calls a consent process on an org to remove it.
  3. -- Depends on the Consent module.
  4. local remove_org_consent = {
  5. name = "Remove this org",
  6. slug = "remove_org_consent",
  7. desc = "Removes an org if all members consent."
  8. }
  9. remove_org_consent.data = {
  10. }
  11. remove_org_consent.config = {
  12. }
  13. function remove_org_consent:initiate(result)
  14. self.org:call_module(
  15. "consent",
  16. self.initiator,
  17. {
  18. prompt = "Remove org " .. self.org.name .. "?",
  19. votes_required = #self.org.members
  20. },
  21. function ()
  22. self:complete()
  23. end
  24. )
  25. modpol.interactions.org_dashboard(
  26. self.initiator, self.org.name)
  27. if result then result() end
  28. end
  29. function remove_org_consent:complete()
  30. modpol.interactions.message_org(
  31. self.initiator, self.org.id,
  32. "Removing org: " .. self.org.name)
  33. self.org:delete()
  34. end
  35. modpol.modules.remove_org_consent = remove_org_consent