Skip to content

Commit 86d869a

Browse files
authored
fix(visitors): Fixes replacing visitor domain. (#14457)
* fix(visitors): Fixes replacing visitor domain. Constructing the visitor room jid instead of doing a risky replacement. The problem is having a room like: [meet-jit-si-shard][email protected] and replacing with 'meet.jit.si', the dots match the -.
1 parent 1c81b93 commit 86d869a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

resources/prosody-plugins/mod_visitors_component.lua

+6-2
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ local function request_promotion_received(room, from_jid, from_vnode, nick, time
9595
local iq_id = new_id();
9696
sent_iq_cache:set(iq_id, socket.gettime());
9797

98+
local node = jid.node(room.jid);
99+
98100
module:send(st.iq({
99101
type='set', to = req_from, from = module.host, id = iq_id })
100102
:tag('visitors', {
101103
xmlns='jitsi:visitors',
102-
room = string.gsub(room.jid, muc_domain_base, req_from),
104+
room = jid.join(node, muc_domain_prefix..'.'..req_from),
103105
focusjid = focus_jid })
104106
:tag('promotion-response', {
105107
xmlns='jitsi:visitors',
@@ -282,11 +284,13 @@ local function process_promotion_response(room, id, approved)
282284
local iq_id = new_id();
283285
sent_iq_cache:set(iq_id, socket.gettime());
284286

287+
local node = jid.node(room.jid);
288+
285289
module:send(st.iq({
286290
type='set', to = req_from, from = module.host, id = iq_id })
287291
:tag('visitors', {
288292
xmlns='jitsi:visitors',
289-
room = string.gsub(room.jid, muc_domain_base, req_from),
293+
room = jid.join(node, muc_domain_prefix..'.'..req_from),
290294
focusjid = focus_jid })
291295
:tag('promotion-response', {
292296
xmlns='jitsi:visitors',

0 commit comments

Comments
 (0)