fix: Fixes #7514 when promoting new moderator and lobby is enabled.
This commit is contained in:
parent
5dcecdbb54
commit
25ae83bcf4
|
@ -17945,8 +17945,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lib-jitsi-meet": {
|
"lib-jitsi-meet": {
|
||||||
"version": "github:jitsi/lib-jitsi-meet#d37024751843711b219ebbe184c4d9c0ae99b7a3",
|
"version": "github:jitsi/lib-jitsi-meet#15dcc57424cc937290e1963b8eb402c1fcf48ccb",
|
||||||
"from": "github:jitsi/lib-jitsi-meet#d37024751843711b219ebbe184c4d9c0ae99b7a3",
|
"from": "github:jitsi/lib-jitsi-meet#15dcc57424cc937290e1963b8eb402c1fcf48ccb",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@jitsi/js-utils": "1.0.0",
|
"@jitsi/js-utils": "1.0.0",
|
||||||
"@jitsi/sdp-interop": "1.0.3",
|
"@jitsi/sdp-interop": "1.0.3",
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
"jquery-i18next": "1.2.1",
|
"jquery-i18next": "1.2.1",
|
||||||
"js-md5": "0.6.1",
|
"js-md5": "0.6.1",
|
||||||
"jwt-decode": "2.2.0",
|
"jwt-decode": "2.2.0",
|
||||||
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#d37024751843711b219ebbe184c4d9c0ae99b7a3",
|
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#15dcc57424cc937290e1963b8eb402c1fcf48ccb",
|
||||||
"libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
|
"libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
|
||||||
"lodash": "4.17.19",
|
"lodash": "4.17.19",
|
||||||
"moment": "2.19.4",
|
"moment": "2.19.4",
|
||||||
|
|
|
@ -132,7 +132,7 @@ function filter_stanza(stanza)
|
||||||
|
|
||||||
-- check is an owner, only owners can receive the presence
|
-- check is an owner, only owners can receive the presence
|
||||||
local room = main_muc_service.get_room_from_jid(jid_bare(node .. '@' .. main_muc_component_config));
|
local room = main_muc_service.get_room_from_jid(jid_bare(node .. '@' .. main_muc_component_config));
|
||||||
if room.get_affiliation(room, stanza.attr.to) == 'owner' then
|
if not room or room.get_affiliation(room, stanza.attr.to) == 'owner' then
|
||||||
return stanza;
|
return stanza;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -159,6 +159,11 @@ function attach_lobby_room(room)
|
||||||
local lobby_room_jid = node .. '@' .. lobby_muc_component_config;
|
local lobby_room_jid = node .. '@' .. lobby_muc_component_config;
|
||||||
if not lobby_muc_service.get_room_from_jid(lobby_room_jid) then
|
if not lobby_muc_service.get_room_from_jid(lobby_room_jid) then
|
||||||
local new_room = lobby_muc_service.create_room(lobby_room_jid);
|
local new_room = lobby_muc_service.create_room(lobby_room_jid);
|
||||||
|
-- set persistent the lobby room to avoid it to be destroyed
|
||||||
|
-- there are cases like when selecting new moderator after the current one leaves
|
||||||
|
-- which can leave the room with no occupants and it will be destroyed and we want to
|
||||||
|
-- avoid lobby destroy while it is enabled
|
||||||
|
new_room:set_persistent(true);
|
||||||
module:log("debug","Lobby room jid = %s created",lobby_room_jid);
|
module:log("debug","Lobby room jid = %s created",lobby_room_jid);
|
||||||
new_room.main_room = room;
|
new_room.main_room = room;
|
||||||
room._data.lobbyroom = new_room;
|
room._data.lobbyroom = new_room;
|
||||||
|
@ -168,6 +173,18 @@ function attach_lobby_room(room)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- destroys lobby room for the supplied main room
|
||||||
|
function destroy_lobby_room(room, newjid, message)
|
||||||
|
if not message then
|
||||||
|
message = 'Lobby room closed.';
|
||||||
|
end
|
||||||
|
if room and room._data.lobbyroom then
|
||||||
|
room._data.lobbyroom:set_persistent(false);
|
||||||
|
room._data.lobbyroom:destroy(newjid, message);
|
||||||
|
room._data.lobbyroom = nil;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- process a host module directly if loaded or hooks to wait for its load
|
-- process a host module directly if loaded or hooks to wait for its load
|
||||||
function process_host_module(name, callback)
|
function process_host_module(name, callback)
|
||||||
local function process_host(host)
|
local function process_host(host)
|
||||||
|
@ -280,16 +297,14 @@ process_host_module(main_muc_component_config, function(host_module, host)
|
||||||
notify_lobby_enabled(room, actor, true);
|
notify_lobby_enabled(room, actor, true);
|
||||||
end
|
end
|
||||||
elseif room._data.lobbyroom then
|
elseif room._data.lobbyroom then
|
||||||
room._data.lobbyroom:destroy(room.jid, 'Lobby room closed.');
|
destroy_lobby_room(room, room.jid);
|
||||||
room._data.lobbyroom = nil;
|
|
||||||
notify_lobby_enabled(room, actor, false);
|
notify_lobby_enabled(room, actor, false);
|
||||||
end
|
end
|
||||||
end);
|
end);
|
||||||
host_module:hook('muc-room-destroyed',function(event)
|
host_module:hook('muc-room-destroyed',function(event)
|
||||||
local room = event.room;
|
local room = event.room;
|
||||||
if room._data.lobbyroom then
|
if room._data.lobbyroom then
|
||||||
room._data.lobbyroom:destroy(nil, 'Lobby room closed.');
|
destroy_lobby_room(room, nil);
|
||||||
room._data.lobbyroom = nil;
|
|
||||||
end
|
end
|
||||||
end);
|
end);
|
||||||
host_module:hook('muc-disco#info', function (event)
|
host_module:hook('muc-disco#info', function (event)
|
||||||
|
@ -399,7 +414,12 @@ function handle_create_lobby(event)
|
||||||
attach_lobby_room(room)
|
attach_lobby_room(room)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function handle_destroy_lobby(event)
|
||||||
|
destroy_lobby_room(event.room, event.newjid, event.message);
|
||||||
|
end
|
||||||
|
|
||||||
module:hook_global('bosh-session', update_session);
|
module:hook_global('bosh-session', update_session);
|
||||||
module:hook_global('websocket-session', update_session);
|
module:hook_global('websocket-session', update_session);
|
||||||
module:hook_global('config-reloaded', load_config);
|
module:hook_global('config-reloaded', load_config);
|
||||||
module:hook_global('create-lobby-room', handle_create_lobby);
|
module:hook_global('create-lobby-room', handle_create_lobby);
|
||||||
|
module:hook_global('destroy-lobby-room', handle_destroy_lobby);
|
||||||
|
|
Loading…
Reference in New Issue