mod_invites_page/mod_invites_page.lua
changeset 4406 85c11eb4331b
parent 4133 ca099bd28bf5
child 4412 2c47b8110c48
equal deleted inserted replaced
4405:52e1ab99d25e 4406:85c11eb4331b
    25 module:depends("register_apps");
    25 module:depends("register_apps");
    26 
    26 
    27 local site_name = module:get_option_string("site_name", module.host);
    27 local site_name = module:get_option_string("site_name", module.host);
    28 local site_apps = module:shared("register_apps/apps");
    28 local site_apps = module:shared("register_apps/apps");
    29 
    29 
       
    30 -- Enable/disable built-in invite pages
       
    31 local external_only = module:get_option_boolean("invites_page_external", false);
       
    32 
    30 local http_files;
    33 local http_files;
    31 
    34 
    32 if prosody.shutdown then
    35 if prosody.shutdown then
    33 	module:depends("http");
    36 	module:depends("http");
    34 	http_files = module:depends("http_files");
    37 	http_files = module:depends("http_files");
    49 	if not invite.allow_registration then return; end
    52 	if not invite.allow_registration then return; end
    50 	invite.landing_page = render_url(invite_url_template, { host = module.host, invite = invite });
    53 	invite.landing_page = render_url(invite_url_template, { host = module.host, invite = invite });
    51 end
    54 end
    52 
    55 
    53 module:hook("invite-created", add_landing_url);
    56 module:hook("invite-created", add_landing_url);
       
    57 
       
    58 if external_only then
       
    59 	return;
       
    60 end
    54 
    61 
    55 local function render_app_urls(apps, invite_vars)
    62 local function render_app_urls(apps, invite_vars)
    56 	local rendered_apps = {};
    63 	local rendered_apps = {};
    57 	for _, unrendered_app in ipairs(apps) do
    64 	for _, unrendered_app in ipairs(apps) do
    58 		local app = setmetatable({}, { __index = unrendered_app });
    65 		local app = setmetatable({}, { __index = unrendered_app });