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(salesforce) use salesforce only in the main room (#11245)

Mihaela Dumitrue062c394e834
diff --git a/lang/main.json b/lang/main.json
index 5081279ee0..fdd75a335e 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -841,7 +841,7 @@
"raisedHandsLabel": "Number of raised hands",
"record": {
"already": {
- "linked": "Record is already linked to this session."
+ "linked": "The meeting is already linked to this Salesforce object."
},
"type": {
"account": "Account",
diff --git a/react/features/base/conference/middleware.any.js b/react/features/base/conference/middleware.any.js
index 1caa8e38cf..035cd682d8 100644
--- a/react/features/base/conference/middleware.any.js
+++ b/react/features/base/conference/middleware.any.js
@@ -15,7 +15,6 @@ import {
NOTIFICATION_TIMEOUT_TYPE,
showErrorNotification
} from '../../notifications';
-import { showSalesforceNotification } from '../../salesforce';
import { CONNECTION_ESTABLISHED, CONNECTION_FAILED, connectionDisconnected } from '../connection';
import { validateJwt } from '../jwt';
import { JitsiConferenceErrors } from '../lib-jitsi-meet';
@@ -240,9 +239,6 @@ function _conferenceJoined({ dispatch, getState }, next, action) {
dispatch(openDisplayNamePrompt(undefined));
}
-
- dispatch(showSalesforceNotification());
-
return result;
}
diff --git a/react/features/conference/middleware.js b/react/features/conference/middleware.js
index 77711cb366..4c89a8fb18 100644
--- a/react/features/conference/middleware.js
+++ b/react/features/conference/middleware.js
@@ -12,6 +12,7 @@ import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
import { SET_REDUCED_UI } from '../base/responsive-ui';
import { FeedbackDialog } from '../feedback';
import { setFilmstripEnabled } from '../filmstrip';
+import { showSalesforceNotification } from '../salesforce/actions';
import { setToolboxEnabled } from '../toolbox/actions';
import { notifyKickedOut } from './actions';
@@ -21,13 +22,12 @@ MiddlewareRegistry.register(store => next => action => {
switch (action.type) {
case CONFERENCE_JOINED:
- case SET_REDUCED_UI: {
- const { dispatch, getState } = store;
- const state = getState();
- const { reducedUI } = state['features/base/responsive-ui'];
+ _conferenceJoined(store);
+
+ break;
- dispatch(setToolboxEnabled(!reducedUI));
- dispatch(setFilmstripEnabled(!reducedUI));
+ case SET_REDUCED_UI: {
+ _setReducedUI(store);
break;
}
@@ -80,3 +80,37 @@ StateListenerRegistry.register(
}
}
});
+
+/**
+ * Configures the UI. In reduced UI mode some components will
+ * be hidden if there is no space to render them.
+ *
+ * @param {Store} store - The redux store in which the specified {@code action}
+ * is being dispatched.
+ * @private
+ * @returns {void}
+ */
+function _setReducedUI({ dispatch, getState }) {
+ const { reducedUI } = getState()['features/base/responsive-ui'];
+
+ dispatch(setToolboxEnabled(!reducedUI));
+ dispatch(setFilmstripEnabled(!reducedUI));
+}
+
+/**
+ * Does extra sync up on properties that may need to be updated after the
+ * conference was joined.
+ *
+ * @param {Store} store - The redux store in which the specified {@code action}
+ * is being dispatched.
+ * @private
+ * @returns {void}
+ */
+function _conferenceJoined({ dispatch, getState }) {
+ _setReducedUI({
+ dispatch,
+ getState
+ });
+
+ dispatch(showSalesforceNotification());
+}
diff --git a/react/features/salesforce/actions.js b/react/features/salesforce/actions.js
index bcc5f9959a..562884695f 100644
--- a/react/features/salesforce/actions.js
+++ b/react/features/salesforce/actions.js
@@ -10,6 +10,7 @@ import {
} from '../notifications';
import { SalesforceLinkDialog } from './components';
+import { isSalesforceEnabled } from './functions';
/**
* Displays the notification for linking the meeting to Salesforce.
@@ -18,9 +19,7 @@ import { SalesforceLinkDialog } from './components';
*/
export function showSalesforceNotification() {
return (dispatch: Object, getState: Function) => {
- const { salesforceUrl } = getState()['features/base/config'];
-
- if (!salesforceUrl) {
+ if (!isSalesforceEnabled(getState())) {
return;
}
diff --git a/react/features/salesforce/functions.js b/react/features/salesforce/functions.js
index fa77d0991f..280fa08f08 100644
--- a/react/features/salesforce/functions.js
+++ b/react/features/salesforce/functions.js
@@ -1,6 +1,21 @@
// @flow
import { doGetJSON } from '../base/util';
+import { isInBreakoutRoom } from '../breakout-rooms/functions';
+
+/**
+ * Determines whether Salesforce is enabled for the current conference.
+ *
+ * @param {Function|Object} state - The redux store, the redux
+ * {@code getState} function, or the redux state itself.
+ * @returns {boolean}
+ */
+export const isSalesforceEnabled = (state: Function | Object) => {
+ const { salesforceUrl } = state['features/base/config'];
+ const isBreakoutRoom = isInBreakoutRoom(state);
+
+ return Boolean(salesforceUrl) && !isBreakoutRoom;
+};
/**
* Fetches the Salesforce records that were most recently interacted with.
diff --git a/react/features/salesforce/index.js b/react/features/salesforce/index.js
deleted file mode 100644
index a6be211266..0000000000
--- a/react/features/salesforce/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './components';
-export * from './actions';
diff --git a/react/features/toolbox/components/native/LinkToSalesforceButton.js b/react/features/toolbox/components/native/LinkToSalesforceButton.js
index 4cc81c1bd7..0e53c08158 100644
--- a/react/features/toolbox/components/native/LinkToSalesforceButton.js
+++ b/react/features/toolbox/components/native/LinkToSalesforceButton.js
@@ -8,6 +8,7 @@ import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/
import { navigate }
from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
import { screen } from '../../../mobile/navigation/routes';
+import { isSalesforceEnabled } from '../../../salesforce/functions';
/**
* Implementation of a button for opening the Salesforce link dialog.
@@ -39,7 +40,7 @@ class LinkToSalesforceButton extends AbstractButton<AbstractButtonProps, *> {
*/
function mapStateToProps(state) {
return {
- visible: Boolean(state['features/base/config'].salesforceUrl)
+ visible: isSalesforceEnabled(state)
};
}
diff --git a/react/features/toolbox/components/web/LinkToSalesforceButton.js b/react/features/toolbox/components/web/LinkToSalesforceButton.js
index 93e67b44e6..d7b3e0ff13 100644
--- a/react/features/toolbox/components/web/LinkToSalesforceButton.js
+++ b/react/features/toolbox/components/web/LinkToSalesforceButton.js
@@ -6,7 +6,7 @@ import { translate } from '../../../base/i18n';
import { IconSalesforce } from '../../../base/icons';
import { connect } from '../../../base/redux';
import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
-import { SalesforceLinkDialog } from '../../../salesforce';
+import { SalesforceLinkDialog } from '../../../salesforce/components';
/**
* The type of the React {@code Component} props of {@link LinkToSalesforce}.
diff --git a/react/features/toolbox/components/web/Toolbox.js b/react/features/toolbox/components/web/Toolbox.js
index e65f6d811b..8f2b177247 100644
--- a/react/features/toolbox/components/web/Toolbox.js
+++ b/react/features/toolbox/components/web/Toolbox.js
@@ -52,6 +52,7 @@ import {
LiveStreamButton,
RecordButton
} from '../../../recording';
+import { isSalesforceEnabled } from '../../../salesforce/functions';
import {
isScreenAudioSupported,
isScreenVideoShared,
@@ -1391,8 +1392,7 @@ function _mapStateToProps(state, ownProps) {
disableProfile,
enableFeaturesBasedOnToken,
iAmRecorder,
- iAmSipGateway,
- salesforceUrl
+ iAmSipGateway
} = state['features/base/config'];
const {
fullScreen,
@@ -1441,7 +1441,7 @@ function _mapStateToProps(state, ownProps) {
_isIosMobile: isIosMobileBrowser(),
_isMobile: isMobileBrowser(),
_isVpaasMeeting: isVpaasMeeting(state),
- _hasSalesforce: Boolean(salesforceUrl),
+ _hasSalesforce: isSalesforceEnabled(state),
_localParticipantID: localParticipant?.id,
_localVideo: localVideo,
_overflowMenuVisible: overflowMenuVisible,