|
@@ -1,20 +1,22 @@
|
|
|
|
+--- Join org (consent)
|
|
|
|
+-- A simple module that calls a consent process on an org to add a member.
|
|
|
|
+-- Depends on the Consent module.
|
|
|
|
|
|
|
|
+join_org_consent = {}
|
|
|
|
|
|
-JoinOrg = {}
|
|
|
|
-
|
|
|
|
-JoinOrg.setup = {
|
|
|
|
- name = "Join an org",
|
|
|
|
|
|
+join_org_consent.setup = {
|
|
|
|
+ name = "Join this org",
|
|
slug = "join_org_consent",
|
|
slug = "join_org_consent",
|
|
- desc = "Consent based join org module"
|
|
|
|
|
|
+ desc = "Adds member with consent of all members."
|
|
}
|
|
}
|
|
|
|
|
|
-function JoinOrg:initiate()
|
|
|
|
|
|
+function join_org_consent:initiate()
|
|
self.org:call_module(
|
|
self.org:call_module(
|
|
"consent",
|
|
"consent",
|
|
self.initiator,
|
|
self.initiator,
|
|
{
|
|
{
|
|
prompt = "Allow " .. self.initiator .. " to join?",
|
|
prompt = "Allow " .. self.initiator .. " to join?",
|
|
- votes_required = 1
|
|
|
|
|
|
+ votes_required = #self.org.members
|
|
},
|
|
},
|
|
function ()
|
|
function ()
|
|
self:complete()
|
|
self:complete()
|
|
@@ -22,9 +24,9 @@ function JoinOrg:initiate()
|
|
)
|
|
)
|
|
end
|
|
end
|
|
|
|
|
|
-function JoinOrg:complete()
|
|
|
|
|
|
+function join_org_consent:complete()
|
|
self.org:add_member(self.initiator)
|
|
self.org:add_member(self.initiator)
|
|
- print("Added " .. self.initiator .. " to the org!")
|
|
|
|
|
|
+ print("Added " .. self.initiator .. " to the org.")
|
|
end
|
|
end
|
|
|
|
|
|
-modpol.modules.join_org_consent = JoinOrg
|
|
|
|
|
|
+modpol.modules.join_org_consent = join_org_consent
|