2
0

remove_org_consent.lua 931 B

123456789101112131415161718192021222324252627282930313233343536373839
  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()
  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. end
  26. function remove_org_consent:complete()
  27. modpol.interactions.message_org(
  28. self.initiator, self.org.id,
  29. "Removing org: " .. self.org.name)
  30. self.org:delete()
  31. modpol.interactions.dashboard(self.initiator)
  32. end
  33. modpol.modules.remove_org_consent = remove_org_consent