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: Fixes leaving the visitor's meeting on promotion. (#14239)

Дамян Минков33e38f95b1a3
diff --git a/react/features/base/conference/actions.ts b/react/features/base/conference/actions.ts
index 9873edec57..2d98a9f351 100644
--- a/react/features/base/conference/actions.ts
+++ b/react/features/base/conference/actions.ts
@@ -1000,8 +1000,6 @@ export function setAssumedBandwidthBps(assumedBandwidthBps: number) {
*/
export function redirect(vnode: string, focusJid: string, username: string) {
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
- const { conference, joining } = getState()['features/base/conference'];
- const currentConference = conference || joining;
const newConfig = getVisitorOptions(getState, vnode, focusJid, username);
if (!newConfig) {
@@ -1011,8 +1009,7 @@ export function redirect(vnode: string, focusJid: string, username: string) {
}
dispatch(overwriteConfig(newConfig)) // @ts-ignore
- .then(() => currentConference && dispatch(conferenceWillLeave(currentConference, true)))
- .then(() => dispatch(disconnect()))
+ .then(() => dispatch(disconnect(true)))
.then(() => dispatch(setIAmVisitor(Boolean(vnode))))
// we do not clear local tracks on error, so we need to manually clear them
diff --git a/react/features/base/connection/actions.any.ts b/react/features/base/connection/actions.any.ts
index aa62450598..286722a87c 100644
--- a/react/features/base/connection/actions.any.ts
+++ b/react/features/base/connection/actions.any.ts
@@ -329,9 +329,11 @@ function _connectionWillConnect(connection: Object) {
/**
* Closes connection.
*
+ * @param {boolean} isRedirect - Indicates if the action has been dispatched as part of visitor promotion.
+ *
* @returns {Function}
*/
-export function disconnect() {
+export function disconnect(isRedirect?: boolean) {
return (dispatch: IStore['dispatch'], getState: IStore['getState']): Promise<void> => {
const state = getState();
@@ -348,7 +350,7 @@ export function disconnect() {
// (and the respective Redux action) which is fired after the
// conference has been left, notify the application about the
// intention to leave the conference.
- dispatch(conferenceWillLeave(conference_));
+ dispatch(conferenceWillLeave(conference_, isRedirect));
promise
= conference_.leave()