comparison mod_invites_page/mod_invites_page.lua @ 4402:85c11eb4331b

mod_invites_page: Allow disabling of built-in pages with invites_page_external option
author Matthew Wild <mwild1@gmail.com>
date Wed, 27 Jan 2021 08:16:26 +0000
parents ca099bd28bf5
children 2c47b8110c48
comparison
equal deleted inserted replaced
4401:52e1ab99d25e 4402: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 });