Skip to content

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

ref: improve handling for room destroyed events (#13591)

Avram Tudor974e2a510616
diff --git a/conference.js b/conference.js
index 5c9239f085..1e50eb14c1 100644
--- a/conference.js
+++ b/conference.js
@@ -130,6 +130,7 @@ import {
isUserInteractionRequiredForUnmute
} from './react/features/base/tracks/functions';
import { downloadJSON } from './react/features/base/util/downloadJSON';
+import { openLeaveReasonDialog } from './react/features/conference/actions.web';
import { showDesktopPicker } from './react/features/desktop-picker/actions';
import { appendSuffix } from './react/features/display-name/functions';
import { maybeOpenFeedbackDialog, submitFeedback } from './react/features/feedback/actions';
@@ -2428,9 +2429,10 @@ export default {
/**
* Disconnect from the conference and optionally request user feedback.
* @param {boolean} [requestFeedback=false] if user feedback should be
+ * @param {string} [hangupReason] the reason for leaving the meeting
* requested
*/
- hangup(requestFeedback = false) {
+ async hangup(requestFeedback = false, hangupReason) {
APP.store.dispatch(disableReceiver());
this._stopProxyConnection();
@@ -2447,36 +2449,33 @@ export default {
APP.UI.removeAllListeners();
- let requestFeedbackPromise;
+ let feedbackResult = {};
if (requestFeedback) {
- requestFeedbackPromise
- = APP.store.dispatch(maybeOpenFeedbackDialog(room))
+ try {
+ feedbackResult = await APP.store.dispatch(maybeOpenFeedbackDialog(room, hangupReason));
+ } catch (err) { // eslint-disable-line no-empty
+ }
+ }
- // false because the thank you dialog shouldn't be displayed
- .catch(() => Promise.resolve(false));
- } else {
- requestFeedbackPromise = Promise.resolve(true);
+ if (!feedbackResult.wasDialogShown && hangupReason) {
+ await APP.store.dispatch(openLeaveReasonDialog(hangupReason));
}
- Promise.all([
- requestFeedbackPromise,
- this.leaveRoom()
- ])
- .then(values => {
- this._room = undefined;
- room = undefined;
-
- /**
- * Don't call {@code notifyReadyToClose} if the promotional page flag is set
- * and let the page take care of sending the message, since there will be
- * a redirect to the page regardlessly.
- */
- if (!interfaceConfig.SHOW_PROMOTIONAL_CLOSE_PAGE) {
- APP.API.notifyReadyToClose();
- }
- APP.store.dispatch(maybeRedirectToWelcomePage(values[0]));
- });
+ await this.leaveRoom();
+
+ this._room = undefined;
+ room = undefined;
+
+ /**
+ * Don't call {@code notifyReadyToClose} if the promotional page flag is set
+ * and let the page take care of sending the message, since there will be
+ * a redirect to the page anyway.
+ */
+ if (!interfaceConfig.SHOW_PROMOTIONAL_CLOSE_PAGE) {
+ APP.API.notifyReadyToClose();
+ }
+ APP.store.dispatch(maybeRedirectToWelcomePage(feedbackResult));
},
/**
diff --git a/lang/main.json b/lang/main.json
index a377dd54a9..3bf33bec1b 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -413,6 +413,7 @@
"sendPrivateMessageTitle": "Send privately?",
"serviceUnavailable": "Service unavailable",
"sessTerminated": "Call terminated",
+ "sessTerminatedReason": "The meeting has been terminated",
"sessionRestarted": "Call restarted because of a connection issue.",
"shareAudio": "Continue",
"shareAudioTitle": "How to share audio",
@@ -658,6 +659,7 @@
"knockingParticipantList": "Knocking participant list",
"lobbyChatStartedNotification": "{{moderator}} started a lobby chat with {{attendee}}",
"lobbyChatStartedTitle": "{{moderator}} has started a lobby chat with you.",
+ "lobbyClosed": "The lobby room has been closed.",
"nameField": "Enter your name",
"notificationLobbyAccessDenied": "{{targetParticipantName}} has been rejected to join by {{originParticipantName}}",
"notificationLobbyAccessGranted": "{{targetParticipantName}} has been allowed to join by {{originParticipantName}}",
diff --git a/react/features/base/conference/constants.ts b/react/features/base/conference/constants.ts
index 4a4c5f0e54..bc84f8a148 100644
--- a/react/features/base/conference/constants.ts
+++ b/react/features/base/conference/constants.ts
@@ -28,9 +28,10 @@ export const EMAIL_COMMAND = 'email';
*/
export const JITSI_CONFERENCE_URL_KEY = Symbol('url');
-export const TRIGGER_READY_TO_CLOSE_REASONS = [
- 'The meeting has been terminated'
-];
+export const TRIGGER_READY_TO_CLOSE_REASONS = {
+ 'dialog.sessTerminatedReason': 'The meeting has been terminated',
+ 'lobby.lobbyClosed': 'Lobby room closed.'
+};
/**
* Conference leave reasons.
@@ -39,8 +40,3 @@ export const CONFERENCE_LEAVE_REASONS = {
SWITCH_ROOM: 'switch_room',
UNRECOVERABLE_ERROR: 'unrecoverable_error'
};
-
-/**
- * Timeout for properly leaving the conference if it was destroyed.
- */
-export const CONFERENCE_DESTROYED_LEAVE_TIMEOUT = 10000;
diff --git a/react/features/base/conference/middleware.any.ts b/react/features/base/conference/middleware.any.ts
index f4f78ebab0..5d347ec075 100644
--- a/react/features/base/conference/middleware.any.ts
+++ b/react/features/base/conference/middleware.any.ts
@@ -14,8 +14,7 @@ import { reloadNow } from '../../app/actions';
import { IStore } from '../../app/types';
import { removeLobbyChatParticipant } from '../../chat/actions.any';
import { openDisplayNamePrompt } from '../../display-name/actions';
-import { readyToClose } from '../../mobile/external-api/actions';
-import { showErrorNotification, showWarningNotification } from '../../notifications/actions';
+import { showErrorNotification } from '../../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
import { stopLocalVideoRecording } from '../../recording/actions.any';
import LocalRecordingManager from '../../recording/components/Recording/LocalRecordingManager';
@@ -55,15 +54,10 @@ import {
conferenceWillInit,
conferenceWillLeave,
createConference,
- leaveConference,
setLocalSubject,
setSubject
} from './actions';
-import {
- CONFERENCE_DESTROYED_LEAVE_TIMEOUT,
- CONFERENCE_LEAVE_REASONS,
- TRIGGER_READY_TO_CLOSE_REASONS
-} from './constants';
+import { CONFERENCE_LEAVE_REASONS } from './constants';
import {
_addLocalTracksToConference,
_removeLocalTracksFromConference,
@@ -153,25 +147,6 @@ function _conferenceFailed({ dispatch, getState }: IStore, next: Function, actio
// Handle specific failure reasons.
switch (error.name) {
- case JitsiConferenceErrors.CONFERENCE_DESTROYED: {
- const [ reason ] = error.params;
-
- dispatch(showWarningNotification({
- description: reason,
- titleKey: 'dialog.sessTerminated'
- }, NOTIFICATION_TIMEOUT_TYPE.LONG));
-
- if (TRIGGER_READY_TO_CLOSE_REASONS.includes(reason)) {
- if (typeof APP === 'undefined') {
- dispatch(readyToClose());
- } else {
- APP.API.notifyReadyToClose();
- }
- setTimeout(() => dispatch(leaveConference()), CONFERENCE_DESTROYED_LEAVE_TIMEOUT);
- }
-
- break;
- }
case JitsiConferenceErrors.CONFERENCE_RESTARTED: {
if (enableForcedReload) {
dispatch(showErrorNotification({
diff --git a/react/features/base/conference/middleware.native.ts b/react/features/base/conference/middleware.native.ts
index fefd329e8a..ad33a2046d 100644
--- a/react/features/base/conference/middleware.native.ts
+++ b/react/features/base/conference/middleware.native.ts
@@ -1 +1,36 @@
+import { appNavigate } from '../../app/actions.native';
+import { notifyConferenceFailed } from '../../conference/actions.native';
+import { JitsiConferenceErrors } from '../lib-jitsi-meet';
+import MiddlewareRegistry from '../redux/MiddlewareRegistry';
+
+import { CONFERENCE_FAILED } from './actionTypes';
+import { conferenceLeft } from './actions';
+import { TRIGGER_READY_TO_CLOSE_REASONS } from './constants';
+
import './middleware.any';
+
+MiddlewareRegistry.register(store => next => action => {
+ const { dispatch } = store;
+ const { error } = action;
+
+ switch (action.type) {
+ case CONFERENCE_FAILED: {
+ if (error?.name !== JitsiConferenceErrors.CONFERENCE_DESTROYED) {
+ break;
+ }
+
+ const [ reason ] = error.params;
+
+ const reasonKey = Object.keys(TRIGGER_READY_TO_CLOSE_REASONS)[
+ Object.values(TRIGGER_READY_TO_CLOSE_REASONS).indexOf(reason)
+ ];
+
+ dispatch(notifyConferenceFailed(reasonKey, () => {
+ dispatch(conferenceLeft(action.conference));
+ dispatch(appNavigate(undefined));
+ }));
+ }
+ }
+
+ return next(action);
+});
diff --git a/react/features/base/conference/middleware.web.ts b/react/features/base/conference/middleware.web.ts
index 9863ea361f..f3686c7b5e 100644
--- a/react/features/base/conference/middleware.web.ts
+++ b/react/features/base/conference/middleware.web.ts
@@ -1,7 +1,10 @@
+import i18next from 'i18next';
+
import {
setPrejoinPageVisibility,
setSkipPrejoinOnReload
} from '../../prejoin/actions.web';
+import { hangup } from '../connection/actions.web';
import { JitsiConferenceErrors } from '../lib-jitsi-meet';
import MiddlewareRegistry from '../redux/MiddlewareRegistry';
@@ -12,7 +15,9 @@ import {
CONFERENCE_LEFT,
KICKED_OUT
} from './actionTypes';
+import { TRIGGER_READY_TO_CLOSE_REASONS } from './constants';
import logger from './logger';
+
import './middleware.any';
let screenLock: WakeLockSentinel | undefined;
@@ -108,6 +113,15 @@ MiddlewareRegistry.register(store => next => action => {
dispatch(setSkipPrejoinOnReload(true));
}
+ if (errorName === JitsiConferenceErrors.CONFERENCE_DESTROYED) {
+ const [ reason ] = action.error.params;
+ const titlekey = Object.keys(TRIGGER_READY_TO_CLOSE_REASONS)[
+ Object.values(TRIGGER_READY_TO_CLOSE_REASONS).indexOf(reason)
+ ];
+
+ dispatch(hangup(true, i18next.t(titlekey) || reason));
+ }
+
releaseScreenLock();
break;
diff --git a/react/features/base/connection/actions.web.ts b/react/features/base/connection/actions.web.ts
index 2e62b54acb..1e614c90fa 100644
--- a/react/features/base/connection/actions.web.ts
+++ b/react/features/base/connection/actions.web.ts
@@ -58,9 +58,10 @@ export function connect(id?: string, password?: string) {
*
* @param {boolean} [requestFeedback] - Whether to attempt showing a
* request for call feedback.
+ * @param {string} [feedbackTitle] - The feedback title.
* @returns {Function}
*/
-export function hangup(requestFeedback = false) {
+export function hangup(requestFeedback = false, feedbackTitle?: string) {
// XXX For web based version we use conference hanging up logic from the old app.
return async (dispatch: IStore['dispatch']) => {
if (LocalRecordingManager.isRecordingLocally()) {
@@ -76,6 +77,6 @@ export function hangup(requestFeedback = false) {
});
}
- return APP.conference.hangup(requestFeedback);
+ return APP.conference.hangup(requestFeedback, feedbackTitle);
};
}
diff --git a/react/features/base/ui/components/web/BaseDialog.tsx b/react/features/base/ui/components/web/BaseDialog.tsx
index f88db90abd..47d86d2da8 100644
--- a/react/features/base/ui/components/web/BaseDialog.tsx
+++ b/react/features/base/ui/components/web/BaseDialog.tsx
@@ -139,6 +139,7 @@ export interface IProps {
onClose?: () => void;
size?: 'large' | 'medium';
submit?: () => void;
+ testId?: string;
title?: string;
titleKey?: string;
}
@@ -152,6 +153,7 @@ const BaseDialog = ({
onClose,
size = 'medium',
submit,
+ testId,
title,
titleKey
}: IProps) => {
@@ -179,7 +181,9 @@ const BaseDialog = ({
}, [ handleKeyDown ]);
return (
- <div className = { cx(classes.container, isUnmounting && 'unmount') }>
+ <div
+ className = { cx(classes.container, isUnmounting && 'unmount') }
+ data-testid = { testId }>
<div className = { classes.backdrop } />
<FocusOn
className = { classes.focusLock }
diff --git a/react/features/base/ui/components/web/Dialog.tsx b/react/features/base/ui/components/web/Dialog.tsx
index 1cbcfa4cb4..61e9808a1b 100644
--- a/react/features/base/ui/components/web/Dialog.tsx
+++ b/react/features/base/ui/components/web/Dialog.tsx
@@ -96,6 +96,7 @@ const Dialog = ({
onCancel,
onSubmit,
size,
+ testId,
title,
titleKey
}: IDialogProps) => {
@@ -127,6 +128,7 @@ const Dialog = ({
onClose = { onClose }
size = { size }
submit = { submit }
+ testId = { testId }
title = { title }
titleKey = { titleKey }>
<div className = { classes.header }>
diff --git a/react/features/conference/actions.native.ts b/react/features/conference/actions.native.ts
index bafc9c0083..49d9701a9f 100644
--- a/react/features/conference/actions.native.ts
+++ b/react/features/conference/actions.native.ts
@@ -1,5 +1,5 @@
import { IStore } from '../app/types';
-import { openDialog } from '../base/dialog/actions';
+import { hideDialog, openDialog } from '../base/dialog/actions';
import AlertDialog from '../base/dialog/components/native/AlertDialog';
import { getParticipantDisplayName } from '../base/participants/functions';
@@ -34,6 +34,38 @@ export function notifyKickedOut(participant: any, submit?: Function) {
};
}
+/**
+ * Notify that we've been kicked out of the conference.
+ *
+ * @param {string} reasonKey - The translation key for the reason why the conference failed.
+ * @param {?Function} submit - The function to execute after submiting the dialog.
+ * @returns {Function}
+ */
+export function notifyConferenceFailed(reasonKey: string, submit?: Function) {
+ return (dispatch: IStore['dispatch']) => {
+ if (!reasonKey) {
+ submit?.();
+
+ return;
+ }
+
+ // we have to push the opening of the dialog to the queue
+ // so that we make sure it will be visible after the events
+ // of conference destroyed are done
+ setTimeout(() => dispatch(openDialog(AlertDialog, {
+ contentKey: {
+ key: reasonKey
+ },
+ params: {
+ },
+ onSubmit: () => {
+ submit?.();
+ dispatch(hideDialog(AlertDialog));
+ }
+ })));
+ };
+}
+
/**
* Dismisses calendar notification about next or ongoing event.
*
diff --git a/react/features/conference/actions.web.ts b/react/features/conference/actions.web.ts
index c1f3273f99..5351550b18 100644
--- a/react/features/conference/actions.web.ts
+++ b/react/features/conference/actions.web.ts
@@ -1,41 +1,26 @@
import { IStore } from '../app/types';
import { configureInitialDevices } from '../base/devices/actions.web';
-import { getParticipantDisplayName } from '../base/participants/functions';
+import { openDialog } from '../base/dialog/actions';
import { getBackendSafeRoomName } from '../base/util/uri';
-import { showNotification } from '../notifications/actions';
-import { NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../notifications/constants';
import { DISMISS_CALENDAR_NOTIFICATION } from './actionTypes';
+import LeaveReasonDialog from './components/web/LeaveReasonDialog.web';
import logger from './logger';
/**
- * Notify that we've been kicked out of the conference.
+ * Opens {@code LeaveReasonDialog}.
*
- * @param {JitsiParticipant} participant - The {@link JitsiParticipant}
- * instance which initiated the kick event.
- * @param {?Function} _ - Used only in native code.
- * @returns {Function}
+ * @param {string} [title] - The dialog title.
+ *
+ * @returns {Promise} Resolved when the dialog is closed.
*/
-export function notifyKickedOut(participant: any, _?: Function) {
- return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
- if (!participant || participant?.isReplaced()) {
- return;
- }
-
- const args = {
- participantDisplayName:
- getParticipantDisplayName(getState, participant.getId())
- };
-
- dispatch(showNotification({
- appearance: NOTIFICATION_TYPE.ERROR,
- hideErrorSupportLink: true,
- descriptionKey: 'dialog.kickMessage',
- descriptionArguments: args,
- titleKey: 'dialog.kickTitle',
- titleArguments: args
- }, NOTIFICATION_TIMEOUT_TYPE.STICKY));
- };
+export function openLeaveReasonDialog(title?: string) {
+ return (dispatch: IStore['dispatch']): Promise<void> => new Promise(resolve => {
+ dispatch(openDialog(LeaveReasonDialog, {
+ onClose: resolve,
+ title
+ }));
+ });
}
/**
diff --git a/react/features/conference/components/web/LeaveReasonDialog.web.tsx b/react/features/conference/components/web/LeaveReasonDialog.web.tsx
new file mode 100644
index 0000000000..f9aa22bdb7
--- /dev/null
+++ b/react/features/conference/components/web/LeaveReasonDialog.web.tsx
@@ -0,0 +1,62 @@
+import React, { useEffect } from 'react';
+import { useTranslation } from 'react-i18next';
+import { makeStyles } from 'tss-react/mui';
+
+import Dialog from '../../../base/ui/components/web/Dialog';
+
+const useStyles = makeStyles()(theme => {
+ return {
+ dialog: {
+ marginBottom: theme.spacing(1)
+ },
+
+ text: {
+ fontSize: '20px'
+ }
+ };
+});
+
+/**
+ * The type of the React {@code Component} props of {@link LeaveReasonDialog}.
+ */
+interface IProps {
+
+ /**
+ * Callback invoked when {@code LeaveReasonDialog} is unmounted.
+ */
+ onClose: () => void;
+
+ /**
+ * The title to display in the dialog.
+ */
+ title?: string;
+}
+
+/**
+ * A React {@code Component} for displaying a dialog with a reason that ended the conference.
+ *
+ * @param {IProps} props - Component's props.
+ * @returns {JSX}
+ */
+const LeaveReasonDialog = ({ onClose, title }: IProps) => {
+ const { classes } = useStyles();
+ const { t } = useTranslation();
+
+ useEffect(() => () => {
+ onClose?.();
+ }, []);
+
+ return (
+ <Dialog
+ cancel = {{ hidden: true }}
+ onSubmit = { onClose }
+ size = 'medium'
+ testId = 'dialog.leaveReason'>
+ <div className = { classes.dialog }>
+ {title ? <div className = { classes.text }>{t(title)}</div> : null}
+ </div>
+ </Dialog>
+ );
+};
+
+export default LeaveReasonDialog;
diff --git a/react/features/conference/middleware.any.ts b/react/features/conference/middleware.any.ts
index 239da5d9e1..9131c39a43 100644
--- a/react/features/conference/middleware.any.ts
+++ b/react/features/conference/middleware.any.ts
@@ -9,10 +9,8 @@ import { IReduxState, IStore } from '../app/types';
import {
CONFERENCE_FAILED,
CONFERENCE_JOINED,
- CONFERENCE_LEFT,
- KICKED_OUT
+ CONFERENCE_LEFT
} from '../base/conference/actionTypes';
-import { conferenceLeft } from '../base/conference/actions';
import { getCurrentConference } from '../base/conference/functions';
import { getURLWithoutParamsNormalized } from '../base/connection/utils';
import { hideDialog } from '../base/dialog/actions';
@@ -41,7 +39,7 @@ import { showSalesforceNotification } from '../salesforce/actions';
import { setToolboxEnabled } from '../toolbox/actions.any';
import { DISMISS_CALENDAR_NOTIFICATION } from './actionTypes';
-import { dismissCalendarNotification, notifyKickedOut } from './actions';
+import { dismissCalendarNotification } from './actions';
import { IFRAME_DISABLED_TIMEOUT_MINUTES, IFRAME_EMBED_ALLOWED_LOCATIONS } from './constants';
@@ -64,20 +62,6 @@ MiddlewareRegistry.register(store => next => action => {
break;
}
- case KICKED_OUT: {
- const { dispatch } = store;
-
- dispatch(notifyKickedOut(
- action.participant,
- () => {
- dispatch(conferenceLeft(action.conference));
- dispatch(appNavigate(undefined));
- }
- ));
-
- break;
- }
-
case DISMISS_CALENDAR_NOTIFICATION:
case CONFERENCE_LEFT:
case CONFERENCE_FAILED: {
diff --git a/react/features/conference/middleware.native.ts b/react/features/conference/middleware.native.ts
index fefd329e8a..4e6fe67c39 100644
--- a/react/features/conference/middleware.native.ts
+++ b/react/features/conference/middleware.native.ts
@@ -1 +1,28 @@
+import { appNavigate } from '../app/actions.native';
+import { KICKED_OUT } from '../base/conference/actionTypes';
+import { conferenceLeft } from '../base/conference/actions';
+import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
+
+import { notifyKickedOut } from './actions.native';
+
import './middleware.any';
+
+MiddlewareRegistry.register(store => next => action => {
+ switch (action.type) {
+ case KICKED_OUT: {
+ const { dispatch } = store;
+
+ dispatch(notifyKickedOut(
+ action.participant,
+ () => {
+ dispatch(conferenceLeft(action.conference));
+ dispatch(appNavigate(undefined));
+ }
+ ));
+
+ break;
+ }
+ }
+
+ return next(action);
+});
diff --git a/react/features/conference/middleware.web.ts b/react/features/conference/middleware.web.ts
index d5f630be6e..ad671e9abe 100644
--- a/react/features/conference/middleware.web.ts
+++ b/react/features/conference/middleware.web.ts
@@ -1,19 +1,35 @@
-import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
+import i18next from 'i18next';
+
+import { CONFERENCE_JOINED, KICKED_OUT } from '../base/conference/actionTypes';
import { IJitsiConference } from '../base/conference/reducer';
+import { hangup } from '../base/connection/actions.web';
import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
+import { getParticipantDisplayName } from '../base/participants/functions';
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { openAllowToggleCameraDialog, setCameraFacingMode } from '../base/tracks/actions.web';
import { CAMERA_FACING_MODE_MESSAGE } from '../base/tracks/constants';
import './middleware.any';
-MiddlewareRegistry.register(_store => next => action => {
+MiddlewareRegistry.register(store => next => action => {
switch (action.type) {
case CONFERENCE_JOINED: {
_addSetCameraFacingModeListener(action.conference);
break;
}
+
+ case KICKED_OUT: {
+ const { dispatch } = store;
+ const { participant } = action;
+
+ const participantDisplayName
+ = getParticipantDisplayName(store.getState, participant.getId());
+
+ dispatch(hangup(true, i18next.t('dialog.kickTitle', { participantDisplayName })));
+
+ break;
+ }
}
return next(action);
diff --git a/react/features/feedback/actions.web.ts b/react/features/feedback/actions.web.ts
index a30bad7338..beb016f7ec 100644
--- a/react/features/feedback/actions.web.ts
+++ b/react/features/feedback/actions.web.ts
@@ -41,14 +41,16 @@ export function cancelFeedback(score: number, message: string) {
* @param {JistiConference} conference - The conference for which the feedback
* would be about. The conference is passed in because feedback can occur after
* a conference has been left, so references to it may no longer exist in redux.
+ * @param {string} title - The feedback dialog title.
* @returns {Promise} Resolved with value - false if the dialog is enabled and
* resolved with true if the dialog is disabled or the feedback was already
* submitted. Rejected if another dialog is already displayed.
*/
-export function maybeOpenFeedbackDialog(conference: IJitsiConference) {
+export function maybeOpenFeedbackDialog(conference: IJitsiConference, title?: string) {
type R = {
feedbackSubmitted: boolean;
showThankYou: boolean;
+ wasDialogShown: boolean;
};
return (dispatch: IStore['dispatch'], getState: IStore['getState']): Promise<R> => {
@@ -67,16 +69,18 @@ export function maybeOpenFeedbackDialog(conference: IJitsiConference) {
return Promise.resolve({
feedbackSubmitted: true,
- showThankYou: true
+ showThankYou: true,
+ wasDialogShown: false
});
} else if (conference.isCallstatsEnabled() && feedbackPercentage > Math.random() * 100) {
return new Promise(resolve => {
- dispatch(openFeedbackDialog(conference, () => {
+ dispatch(openFeedbackDialog(conference, title, () => {
const { submitted } = getState()['features/feedback'];
resolve({
feedbackSubmitted: submitted,
- showThankYou: false
+ showThankYou: false,
+ wasDialogShown: true
});
}));
});
@@ -87,7 +91,8 @@ export function maybeOpenFeedbackDialog(conference: IJitsiConference) {
// act on it.
return Promise.resolve({
feedbackSubmitted: false,
- showThankYou: true
+ showThankYou: true,
+ wasDialogShown: false
});
};
}
@@ -98,14 +103,16 @@ export function maybeOpenFeedbackDialog(conference: IJitsiConference) {
* @param {JitsiConference} conference - The JitsiConference that is being
* rated. The conference is passed in because feedback can occur after a
* conference has been left, so references to it may no longer exist in redux.
+ * @param {string} [title] - The feedback dialog title.
* @param {Function} [onClose] - An optional callback to invoke when the dialog
* is closed.
* @returns {Object}
*/
-export function openFeedbackDialog(conference?: IJitsiConference, onClose?: Function) {
+export function openFeedbackDialog(conference?: IJitsiConference, title?: string, onClose?: Function) {
return openDialog(FeedbackDialog, {
conference,
- onClose
+ onClose,
+ title
});
}
diff --git a/react/features/feedback/components/FeedbackDialog.web.tsx b/react/features/feedback/components/FeedbackDialog.web.tsx
index 29c159df23..e3c800958e 100644
--- a/react/features/feedback/components/FeedbackDialog.web.tsx
+++ b/react/features/feedback/components/FeedbackDialog.web.tsx
@@ -60,6 +60,10 @@ const useStyles = makeStyles()(theme => {
}
},
+ title: {
+ fontSize: '16px'
+ },
+
details: {
'& textarea': {
minHeight: '122px'
@@ -98,6 +102,11 @@ interface IProps {
* Callback invoked when {@code FeedbackDialog} is unmounted.
*/
onClose: Function;
+
+ /**
+ * The title to display in the dialog. Usually the reason that triggered the feedback.
+ */
+ title?: string;
}
/**
@@ -108,7 +117,7 @@ interface IProps {
* @param {IProps} props - Component's props.
* @returns {JSX}
*/
-const FeedbackDialog = ({ conference, onClose }: IProps) => {
+const FeedbackDialog = ({ conference, onClose, title }: IProps) => {
const { classes } = useStyles();
const dispatch = useDispatch();
const { t } = useTranslation();
@@ -284,6 +293,7 @@ const FeedbackDialog = ({ conference, onClose }: IProps) => {
size = 'large'
titleKey = 'feedback.rateExperience'>
<div className = { classes.dialog }>
+ {title ? <div className = { classes.title }>{t(title)}</div> : null}
<div className = { classes.rating }>
<div
className = { classes.stars }
diff --git a/react/features/toolbox/components/native/HangupMenu.tsx b/react/features/toolbox/components/native/HangupMenu.tsx
index fba0b5f471..49cd70ecee 100644
--- a/react/features/toolbox/components/native/HangupMenu.tsx
+++ b/react/features/toolbox/components/native/HangupMenu.tsx
@@ -34,7 +34,6 @@ function HangupMenu() {
dispatch(hideSheet());
sendAnalytics(createToolbarEvent('endmeeting'));
dispatch(endConference());
- dispatch(appNavigate(undefined));
}, [ hideSheet ]);
const handleLeaveConference = useCallback(() => {