feat(visitors): Force promote works for all moderators.

fix-p2p-codecs jitsi-meet_9595
damencho 1 year ago committed by Дамян Минков
parent 9076fb3e4a
commit 8ddab7464c
  1. 10
      resources/prosody-plugins/mod_fmuc.lua
  2. 1
      resources/prosody-plugins/mod_visitors.lua
  3. 14
      resources/prosody-plugins/mod_visitors_component.lua

@ -247,9 +247,12 @@ module:hook('muc-broadcast-presence', function (event)
if identity and identity.id then
user_id = session.jitsi_meet_context_user.id;
-- non-vpass and having a token in correct tenant is considered a moderator
if session.jitsi_meet_str_tenant
and session.jitsi_web_query_prefix == string.lower(session.jitsi_meet_str_tenant) then
if room._data.moderator_id then
if room._data.moderator_id == user_id then
is_moderator = true;
end
elseif session.auth_token then
-- non-vpass and having a token is considered a moderator
is_moderator = true;
end
end
@ -540,6 +543,7 @@ local function iq_from_main_handler(event)
-- if this is update it will either set or remove the password
room:set_password(node.attr.password);
room._data.meetingId = node.attr.meetingId;
room._data.moderator_id = node.attr.moderatorId;
local createdTimestamp = node.attr.createdTimestamp;
room.created_timestamp = createdTimestamp and tonumber(createdTimestamp) or nil;

@ -68,6 +68,7 @@ local function send_visitors_iq(conference_service, room, type)
password = type ~= 'disconnect' and room:get_password() or '',
lobby = room._data.lobbyroom and 'true' or 'false',
meetingId = room._data.meetingId,
moderatorId = room._data.moderator_id, -- can be used from external modules to set single moderator for meetings
createdTimestamp = room.created_timestamp and tostring(room.created_timestamp) or nil
}):up();

@ -78,7 +78,6 @@ local function request_promotion_received(room, from_jid, from_vnode, nick, time
-- only for raise hand, ignore lowering the hand
if time and time > 0 and (
auto_allow_promotion
or (user_id and user_id == room._data.moderator_id)
or force_promote == 'true') then
-- we are in auto-allow mode, let's reply with accept
-- we store where the request is coming from so we can send back the response
@ -231,17 +230,6 @@ local function stanza_handler(event)
return true; -- stop processing
end
local force_promote = request_promotion.attr.forcePromote;
if force_promote == 'true' and not is_vpaas(room) then
-- allow force promote only in case there are no moderators in the room
for _, occupant in room:each_occupant() do
if occupant.role == 'moderator' and not is_admin(occupant.bare_jid) then
force_promote = false;
break;
end
end
end
local display_name = visitors_iq:get_child_text('nick', 'http://jabber.org/protocol/nick');
processed = request_promotion_received(
room,
@ -250,7 +238,7 @@ local function stanza_handler(event)
display_name,
tonumber(request_promotion.attr.time),
request_promotion.attr.userId,
force_promote
request_promotion.attr.forcePromote
);
end

Loading…
Cancel
Save