Skip to content

Commit

Permalink
fix(connection): Shows notification instead of reload on conference r…
Browse files Browse the repository at this point in the history
…equest failed.
  • Loading branch information
damencho committed Nov 15, 2024
1 parent 49cf632 commit e38cb02
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions lang/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@
"connectedOneMember": "{{name}} joined the meeting",
"connectedThreePlusMembers": "{{name}} and many others joined the meeting",
"connectedTwoMembers": "{{first}} and {{second}} joined the meeting",
"connectionFailed": "Connection failed. Please try again later!",
"dataChannelClosed": "Video quality may be impaired",
"dataChannelClosedDescription": "The bridge channel is down and thus video quality may be limited to its lowest setting.",
"dataChannelClosedDescriptionWithAudio": "The bridge channel is down and thus disruptions to audio and video may occur.",
Expand Down
13 changes: 12 additions & 1 deletion react/features/base/conference/middleware.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import { IStore } from '../../app/types';
import { removeLobbyChatParticipant } from '../../chat/actions.any';
import { openDisplayNamePrompt } from '../../display-name/actions';
import { isVpaasMeeting } from '../../jaas/functions';
import { showErrorNotification } from '../../notifications/actions';
import { showErrorNotification, showNotification } from '../../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
import { INotificationProps } from '../../notifications/types';
import { hasDisplayName } from '../../prejoin/utils';
import { stopLocalVideoRecording } from '../../recording/actions.any';
import LocalRecordingManager from '../../recording/components/Recording/LocalRecordingManager';
Expand Down Expand Up @@ -419,6 +420,16 @@ function _connectionFailed({ dispatch, getState }: IStore, next: Function, actio
}
}

if (error.name === JitsiConnectionErrors.CONFERENCE_REQUEST_FAILED) {
const notificationProps = {
customActionNameKey: [ 'dialog.rejoinNow' ],
customActionHandler: [ () => dispatch(reloadNow()) ],
descriptionKey: 'notify.connectionFailed'
} as INotificationProps;

dispatch(showNotification(notificationProps, NOTIFICATION_TIMEOUT_TYPE.STICKY));
}

const result = next(action);

_removeUnloadHandler(getState);
Expand Down
5 changes: 2 additions & 3 deletions react/features/base/connection/actions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IReduxState, IStore } from '../../app/types';
import { conferenceLeft, conferenceWillLeave, redirect } from '../conference/actions';
import { getCurrentConference } from '../conference/functions';
import { IConfigState } from '../config/reducer';
import JitsiMeetJS, { JitsiConnectionErrors, JitsiConnectionEvents } from '../lib-jitsi-meet';
import JitsiMeetJS, { JitsiConnectionEvents } from '../lib-jitsi-meet';
import { parseURLParams } from '../util/parseURLParams';
import {
appendURLParam,
Expand Down Expand Up @@ -288,8 +288,7 @@ export function _connectInternal(id?: string, password?: string) {
credentials,
details,
name: err,
message,
recoverable: err === JitsiConnectionErrors.CONFERENCE_REQUEST_FAILED ? false : undefined
message
}));

reject(err);
Expand Down
3 changes: 1 addition & 2 deletions react/features/base/lib-jitsi-meet/functions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ export function isFatalJitsiConnectionError(error: Error | string | ConnectionFa
}

return (
error === JitsiConnectionErrors.CONFERENCE_REQUEST_FAILED
|| error === JitsiConnectionErrors.CONNECTION_DROPPED_ERROR
error === JitsiConnectionErrors.CONNECTION_DROPPED_ERROR
|| error === JitsiConnectionErrors.OTHER_ERROR
|| error === JitsiConnectionErrors.SERVER_ERROR);
}

0 comments on commit e38cb02

Please sign in to comment.