123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- --- @module add_child_org
- -- Adds a child org
- -- Depends on `consent`
- local add_child_org = {
- name = "Add child org",
- slug = "add_child_org",
- desc = "Create a child org within the current one with consent"
- }
- add_child_org.data = {
- child_name = ""
- }
- add_child_org.config = {
- }
- -- @function initiate
- function add_child_org:initiate(config, result)
- modpol.interactions.text_query(
- self.initiator,"Child org name: ",
- function(input)
- if input == "" then
- modpol.interactions.message(
- self.initiator,
- "No name entered for child org")
- self.org:delete_process(self.id)
- return end
- self.data.child_name = input
- modpol.interactions.message(
- self.initiator,
- "Proposed child org: " .. input)
- -- initiate consent process
- self.org:call_module(
- "consent",
- self.initiator,
- {
- prompt = "Create child org " ..
- self.data.child_name .. "?",
- votes_required = #self.org.members
- },
- function()
- self:create_child_org()
- end
- )
- modpol.interactions.org_dashboard(
- self.initiator, self.org.name)
- end
- )
- end
- function add_child_org:create_child_org()
- self.org:add_org(self.data.child_name, self.initiator)
- modpol.interactions.message_org(
- self.initiator,
- self.org.name,
- "Child org created: "..self.data.child_name)
- self.org:delete_process(self.id)
- end
-
- --- (Required) Add to module table
- modpol.modules.add_child_org = add_child_org
|