Skip to content

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

fix(visitors): Fixes demoting correct participant.

damencho7140a9020160
diff --git a/react/features/visitors/middleware.ts b/react/features/visitors/middleware.ts
index d2c3f909d2..309f58b3ca 100644
--- a/react/features/visitors/middleware.ts
+++ b/react/features/visitors/middleware.ts
@@ -11,7 +11,7 @@ import { connect, setPreferVisitor } from '../base/connection/actions';
import { disconnect } from '../base/connection/actions.any';
import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
import { raiseHand } from '../base/participants/actions';
-import { getParticipantById } from '../base/participants/functions';
+import { getLocalParticipant, getParticipantById } from '../base/participants/functions';
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { BUTTON_TYPES } from '../base/ui/constants.any';
import { hideNotification, showNotification } from '../notifications/actions';
@@ -79,23 +79,26 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
}
conference.on(JitsiConferenceEvents.VISITORS_MESSAGE, (
- msg: { action: string; actor: string; from: string; nick: string; on: boolean; }) => {
+ msg: { action: string; actor: string; from: string; id: string; nick: string; on: boolean; }) => {
if (msg.action === 'demote-request') {
// we need it before the disconnect
const participantById = getParticipantById(getState, msg.actor);
-
- // handle demote
- dispatch(disconnect(true))
- .then(() => dispatch(setPreferVisitor(true)))
- .then(() => {
- // we need to set the name so we can use it later in the notification
- if (participantById) {
- dispatch(setVisitorDemoteActor(participantById.name));
- }
-
- return dispatch(connect());
- });
+ const localParticipant = getLocalParticipant(getState);
+
+ if (localParticipant && localParticipant.id === msg.id) {
+ // handle demote
+ dispatch(disconnect(true))
+ .then(() => dispatch(setPreferVisitor(true)))
+ .then(() => {
+ // we need to set the name, so we can use it later in the notification
+ if (participantById) {
+ dispatch(setVisitorDemoteActor(participantById.name));
+ }
+
+ return dispatch(connect());
+ });
+ }
} else if (msg.action === 'promotion-request') {
const request = {
from: msg.from,
diff --git a/resources/prosody-plugins/mod_muc_lobby_rooms.lua b/resources/prosody-plugins/mod_muc_lobby_rooms.lua
index d277bf88ae..d6f860577c 100644
--- a/resources/prosody-plugins/mod_muc_lobby_rooms.lua
+++ b/resources/prosody-plugins/mod_muc_lobby_rooms.lua
@@ -339,7 +339,7 @@ local prosody_overrides = {
local x = stanza:get_child("x", "http://jabber.org/protocol/muc#user");
if x then
local handled = false;
- for _, payload in pairs(x.tags) do -- for payload in x:children() do
+ for _, payload in pairs(x.tags) do
if payload ~= nil and payload.name == "invite" and payload.attr.to then
handled = true;
handle_mediated_invite(room, origin, stanza, payload, host_module)