Browse Source

fix(salesforce) use salesforce only in the main room (#11245)

master
Mihaela Dumitru 3 years ago
parent
commit
e062c394e8
No account linked to committer's email address

+ 1
- 1
lang/main.json View File

@@ -841,7 +841,7 @@
841 841
     "raisedHandsLabel": "Number of raised hands",
842 842
     "record": {
843 843
         "already": {
844
-            "linked": "Record is already linked to this session."
844
+            "linked": "The meeting is already linked to this Salesforce object."
845 845
         },
846 846
         "type": {
847 847
             "account": "Account",

+ 0
- 4
react/features/base/conference/middleware.any.js View File

@@ -15,7 +15,6 @@ import {
15 15
     NOTIFICATION_TIMEOUT_TYPE,
16 16
     showErrorNotification
17 17
 } from '../../notifications';
18
-import { showSalesforceNotification } from '../../salesforce';
19 18
 import { CONNECTION_ESTABLISHED, CONNECTION_FAILED, connectionDisconnected } from '../connection';
20 19
 import { validateJwt } from '../jwt';
21 20
 import { JitsiConferenceErrors } from '../lib-jitsi-meet';
@@ -240,9 +239,6 @@ function _conferenceJoined({ dispatch, getState }, next, action) {
240 239
         dispatch(openDisplayNamePrompt(undefined));
241 240
     }
242 241
 
243
-
244
-    dispatch(showSalesforceNotification());
245
-
246 242
     return result;
247 243
 }
248 244
 

+ 40
- 6
react/features/conference/middleware.js View File

@@ -12,6 +12,7 @@ import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
12 12
 import { SET_REDUCED_UI } from '../base/responsive-ui';
13 13
 import { FeedbackDialog } from '../feedback';
14 14
 import { setFilmstripEnabled } from '../filmstrip';
15
+import { showSalesforceNotification } from '../salesforce/actions';
15 16
 import { setToolboxEnabled } from '../toolbox/actions';
16 17
 
17 18
 import { notifyKickedOut } from './actions';
@@ -21,13 +22,12 @@ MiddlewareRegistry.register(store => next => action => {
21 22
 
22 23
     switch (action.type) {
23 24
     case CONFERENCE_JOINED:
24
-    case SET_REDUCED_UI: {
25
-        const { dispatch, getState } = store;
26
-        const state = getState();
27
-        const { reducedUI } = state['features/base/responsive-ui'];
25
+        _conferenceJoined(store);
26
+
27
+        break;
28 28
 
29
-        dispatch(setToolboxEnabled(!reducedUI));
30
-        dispatch(setFilmstripEnabled(!reducedUI));
29
+    case SET_REDUCED_UI: {
30
+        _setReducedUI(store);
31 31
 
32 32
         break;
33 33
     }
@@ -80,3 +80,37 @@ StateListenerRegistry.register(
80 80
             }
81 81
         }
82 82
     });
83
+
84
+/**
85
+ * Configures the UI. In reduced UI mode some components will
86
+ * be hidden if there is no space to render them.
87
+ *
88
+ * @param {Store} store - The redux store in which the specified {@code action}
89
+ * is being dispatched.
90
+ * @private
91
+ * @returns {void}
92
+ */
93
+function _setReducedUI({ dispatch, getState }) {
94
+    const { reducedUI } = getState()['features/base/responsive-ui'];
95
+
96
+    dispatch(setToolboxEnabled(!reducedUI));
97
+    dispatch(setFilmstripEnabled(!reducedUI));
98
+}
99
+
100
+/**
101
+ * Does extra sync up on properties that may need to be updated after the
102
+ * conference was joined.
103
+ *
104
+ * @param {Store} store - The redux store in which the specified {@code action}
105
+ * is being dispatched.
106
+ * @private
107
+ * @returns {void}
108
+ */
109
+function _conferenceJoined({ dispatch, getState }) {
110
+    _setReducedUI({
111
+        dispatch,
112
+        getState
113
+    });
114
+
115
+    dispatch(showSalesforceNotification());
116
+}

+ 2
- 3
react/features/salesforce/actions.js View File

@@ -10,6 +10,7 @@ import {
10 10
 } from '../notifications';
11 11
 
12 12
 import { SalesforceLinkDialog } from './components';
13
+import { isSalesforceEnabled } from './functions';
13 14
 
14 15
 /**
15 16
  * Displays the notification for linking the meeting to Salesforce.
@@ -18,9 +19,7 @@ import { SalesforceLinkDialog } from './components';
18 19
  */
19 20
 export function showSalesforceNotification() {
20 21
     return (dispatch: Object, getState: Function) => {
21
-        const { salesforceUrl } = getState()['features/base/config'];
22
-
23
-        if (!salesforceUrl) {
22
+        if (!isSalesforceEnabled(getState())) {
24 23
             return;
25 24
         }
26 25
 

+ 15
- 0
react/features/salesforce/functions.js View File

@@ -1,6 +1,21 @@
1 1
 // @flow
2 2
 
3 3
 import { doGetJSON } from '../base/util';
4
+import { isInBreakoutRoom } from '../breakout-rooms/functions';
5
+
6
+/**
7
+ * Determines whether Salesforce is enabled for the current conference.
8
+ *
9
+ * @param {Function|Object} state - The redux store, the redux
10
+ * {@code getState} function, or the redux state itself.
11
+ * @returns {boolean}
12
+ */
13
+export const isSalesforceEnabled = (state: Function | Object) => {
14
+    const { salesforceUrl } = state['features/base/config'];
15
+    const isBreakoutRoom = isInBreakoutRoom(state);
16
+
17
+    return Boolean(salesforceUrl) && !isBreakoutRoom;
18
+};
4 19
 
5 20
 /**
6 21
  * Fetches the Salesforce records that were most recently interacted with.

+ 0
- 2
react/features/salesforce/index.js View File

@@ -1,2 +0,0 @@
1
-export * from './components';
2
-export * from './actions';

+ 2
- 1
react/features/toolbox/components/native/LinkToSalesforceButton.js View File

@@ -8,6 +8,7 @@ import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/
8 8
 import { navigate }
9 9
     from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
10 10
 import { screen } from '../../../mobile/navigation/routes';
11
+import { isSalesforceEnabled } from '../../../salesforce/functions';
11 12
 
12 13
 /**
13 14
  * Implementation of a button for opening the Salesforce link dialog.
@@ -39,7 +40,7 @@ class LinkToSalesforceButton extends AbstractButton<AbstractButtonProps, *> {
39 40
  */
40 41
 function mapStateToProps(state) {
41 42
     return {
42
-        visible: Boolean(state['features/base/config'].salesforceUrl)
43
+        visible: isSalesforceEnabled(state)
43 44
     };
44 45
 }
45 46
 

+ 1
- 1
react/features/toolbox/components/web/LinkToSalesforceButton.js View File

@@ -6,7 +6,7 @@ import { translate } from '../../../base/i18n';
6 6
 import { IconSalesforce } from '../../../base/icons';
7 7
 import { connect } from '../../../base/redux';
8 8
 import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
9
-import { SalesforceLinkDialog } from '../../../salesforce';
9
+import { SalesforceLinkDialog } from '../../../salesforce/components';
10 10
 
11 11
 /**
12 12
  * The type of the React {@code Component} props of {@link LinkToSalesforce}.

+ 3
- 3
react/features/toolbox/components/web/Toolbox.js View File

@@ -52,6 +52,7 @@ import {
52 52
     LiveStreamButton,
53 53
     RecordButton
54 54
 } from '../../../recording';
55
+import { isSalesforceEnabled } from '../../../salesforce/functions';
55 56
 import {
56 57
     isScreenAudioSupported,
57 58
     isScreenVideoShared,
@@ -1391,8 +1392,7 @@ function _mapStateToProps(state, ownProps) {
1391 1392
         disableProfile,
1392 1393
         enableFeaturesBasedOnToken,
1393 1394
         iAmRecorder,
1394
-        iAmSipGateway,
1395
-        salesforceUrl
1395
+        iAmSipGateway
1396 1396
     } = state['features/base/config'];
1397 1397
     const {
1398 1398
         fullScreen,
@@ -1441,7 +1441,7 @@ function _mapStateToProps(state, ownProps) {
1441 1441
         _isIosMobile: isIosMobileBrowser(),
1442 1442
         _isMobile: isMobileBrowser(),
1443 1443
         _isVpaasMeeting: isVpaasMeeting(state),
1444
-        _hasSalesforce: Boolean(salesforceUrl),
1444
+        _hasSalesforce: isSalesforceEnabled(state),
1445 1445
         _localParticipantID: localParticipant?.id,
1446 1446
         _localVideo: localVideo,
1447 1447
         _overflowMenuVisible: overflowMenuVisible,

Loading…
Cancel
Save