Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(metadata): Append moderators to the list of main participants for jicofo. (#16097)

Дамян Минков45cfc0e112f5
diff --git a/resources/prosody-plugins/mod_room_metadata_component.lua b/resources/prosody-plugins/mod_room_metadata_component.lua
index c8f03065ae..a026bc8c07 100644
--- a/resources/prosody-plugins/mod_room_metadata_component.lua
+++ b/resources/prosody-plugins/mod_room_metadata_component.lua
@@ -24,6 +24,7 @@ local room_jid_match_rewrite = util.room_jid_match_rewrite;
local internal_room_jid_match_rewrite = util.internal_room_jid_match_rewrite;
local process_host_module = util.process_host_module;
local table_shallow_copy = util.table_shallow_copy;
+local table_add = util.table_add;
local MUC_NS = 'http://jabber.org/protocol/muc';
local COMPONENT_IDENTITY_TYPE = 'room_metadata';
@@ -83,9 +84,25 @@ function send_metadata(occupant, room, json_msg)
local metadata_to_send = room.jitsiMetadata or {};
-- we want to send the main meeting participants only to jicofo
- if is_admin(occupant.bare_jid) and room._data.mainMeetingParticipants then
- metadata_to_send = table_shallow_copy(metadata_to_send);
- metadata_to_send.mainMeetingParticipants = room._data.mainMeetingParticipants;
+ if is_admin(occupant.bare_jid) then
+ local participants = {};
+
+ if room._data.mainMeetingParticipants then
+ table_add(participants, room._data.mainMeetingParticipants);
+ end
+
+ if room._data.moderator_id then
+ table.insert(participants, room._data.moderator_id);
+ end
+
+ if room._data.moderators then
+ table_add(participants, room._data.moderators);
+ end
+
+ if #participants > 0 then
+ metadata_to_send = table_shallow_copy(metadata_to_send);
+ metadata_to_send.mainMeetingParticipants = participants;
+ end
end
json_msg = getMetadataJSON(room, metadata_to_send);
diff --git a/resources/prosody-plugins/util.lib.lua b/resources/prosody-plugins/util.lib.lua
index f723b24edf..32fde7486a 100644
--- a/resources/prosody-plugins/util.lib.lua
+++ b/resources/prosody-plugins/util.lib.lua
@@ -612,6 +612,13 @@ local function table_find(tab, val)
return nil
end
+-- Adds second table values to the first table
+local function table_add(t1, t2)
+ for _,v in ipairs(t2) do
+ table.insert(t1, v);
+ end
+end
+
-- Splits a string using delimiter
function split_string(str, delimiter)
str = str .. delimiter;
@@ -692,6 +699,7 @@ return {
split_string = split_string;
starts_with = starts_with;
starts_with_one_of = starts_with_one_of;
+ table_add = table_add;
table_shallow_copy = table_shallow_copy;
table_find = table_find;
};