Comparison

plugins/mod_invites.lua @ 13741:e9edf9b50f32 13.0

mod_invites: Hide --group flag unless mod_invites_groups is enabled The WIP groups support is not complete yet, and won't work without extra modules (which are not yet a part of Prosody). For now we hide --group support unless mod_invites_groups (community module) is specified in modules_enabled.
author Matthew Wild <mwild1@gmail.com>
date Mon, 17 Feb 2025 23:06:06 +0000
parent 13740:4cf2caa63277
comparison
equal deleted inserted replaced
13740:4cf2caa63277 13741:e9edf9b50f32
237 end 237 end
238 238
239 module:hook("invite-created", add_landing_url, -1); 239 module:hook("invite-created", add_landing_url, -1);
240 240
241 --- shell command 241 --- shell command
242 -- COMPAT: Dynamic groups are work in progress as of 13.0, so we'll use the
243 -- presence of mod_invites_groups (a community module) to determine whether to
244 -- expose our support for invites to groups.
245 local have_group_invites = module:get_option_inherited_set("modules_enabled"):contains("invites_groups");
246
242 module:add_item("shell-command", { 247 module:add_item("shell-command", {
243 section = "invite"; 248 section = "invite";
244 section_desc = "Create and manage invitations"; 249 section_desc = "Create and manage invitations";
245 name = "create_account"; 250 name = "create_account";
246 desc = "Create an invitation to make an account on this server with the specified JID (supply only a hostname to allow any username)"; 251 desc = "Create an invitation to make an account on this server with the specified JID (supply only a hostname to allow any username)";
247 args = { 252 args = {
248 { name = "user_jid", type = "string" }; 253 { name = "user_jid", type = "string" };
249 }; 254 };
250 host_selector = "user_jid"; 255 host_selector = "user_jid";
251 flags = { 256 flags = {
252 array_params = { role = true, group = true }; 257 array_params = { role = true, group = have_group_invites };
253 value_params = { expires_after = true }; 258 value_params = { expires_after = true };
254 }; 259 };
255 260
256 handler = function (self, user_jid, opts) --luacheck: ignore 212/self 261 handler = function (self, user_jid, opts) --luacheck: ignore 212/self
257 local username = jid_split(user_jid); 262 local username = jid_split(user_jid);