Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2063 from matrix-org/dbkr/jitsi_check_scalar_first
Browse files Browse the repository at this point in the history
Jitsi: Check integrations server before call
  • Loading branch information
bwindels committed Jul 17, 2018
2 parents 583cde6 + 850a4d8 commit 0a432df
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
25 changes: 24 additions & 1 deletion src/CallHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import dis from './dispatcher';
import { showUnknownDeviceDialogForCalls } from './cryptodevices';
import SettingsStore from "./settings/SettingsStore";
import WidgetUtils from './utils/WidgetUtils';
import ScalarAuthClient from './ScalarAuthClient';

global.mxCalls = {
//room_id: MatrixCall
Expand Down Expand Up @@ -401,7 +402,29 @@ function _onAction(payload) {
}
}

function _startCallApp(roomId, type) {
async function _startCallApp(roomId, type) {
// check for a working intgrations manager. Technically we could put
// the state event in anyway, but the resulting widget would then not
// work for us. Better that the user knows before everyone else in the
// room sees it.
const scalarClient = new ScalarAuthClient();
let haveScalar = false;
try {
await scalarClient.connect();
haveScalar = scalarClient.hasCredentials();
} catch (e) {
// fall through
}
if (!haveScalar) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");

Modal.createTrackedDialog('Could not connect to the integration server', '', ErrorDialog, {
title: _t('Could not connect to the integration server'),
description: _t('A conference call could not be started because the intgrations server is not available'),
});
return;
}

dis.dispatch({
action: 'appsDrawer',
show: true,
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
"Conference calling is in development and may not be reliable.": "Conference calling is in development and may not be reliable.",
"Failed to set up conference call": "Failed to set up conference call",
"Conference call failed.": "Conference call failed.",
"Could not connect to the integration server": "Could not connect to the integration server",
"A conference call could not be started because the intgrations server is not available": "A conference call could not be started because the intgrations server is not available",
"Call in Progress": "Call in Progress",
"A call is already in progress!": "A call is already in progress!",
"Permission Required": "Permission Required",
Expand Down Expand Up @@ -712,7 +714,6 @@
"Uploaded on %(date)s by %(user)s": "Uploaded on %(date)s by %(user)s",
"Download this file": "Download this file",
"Integrations Error": "Integrations Error",
"Could not connect to the integration server": "Could not connect to the integration server",
"Manage Integrations": "Manage Integrations",
"%(nameList)s %(transitionList)s": "%(nameList)s %(transitionList)s",
"%(severalUsers)sjoined %(count)s times|other": "%(severalUsers)sjoined %(count)s times",
Expand Down

0 comments on commit 0a432df

Please sign in to comment.