Merge remote-tracking branch 'origin/develop' into travis/terms/inline-is-only
This commit is contained in:
commit
2456912ec7
5 changed files with 105 additions and 70 deletions
|
@ -22,6 +22,7 @@ import MatrixClientPeg from "../../../MatrixClientPeg";
|
|||
import SdkConfig from "../../../SdkConfig";
|
||||
import Modal from '../../../Modal';
|
||||
import dis from "../../../dispatcher";
|
||||
import { getThreepidBindStatus } from '../../../boundThreepids';
|
||||
import IdentityAuthClient from "../../../IdentityAuthClient";
|
||||
import {SERVICE_TYPES} from "matrix-js-sdk";
|
||||
|
||||
|
@ -100,6 +101,7 @@ export default class SetIdServer extends React.Component {
|
|||
idServer: defaultIdServer,
|
||||
error: null,
|
||||
busy: false,
|
||||
disconnectBusy: false,
|
||||
checking: false,
|
||||
};
|
||||
}
|
||||
|
@ -193,24 +195,45 @@ export default class SetIdServer extends React.Component {
|
|||
});
|
||||
};
|
||||
|
||||
_onDisconnectClicked = () => {
|
||||
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||
Modal.createTrackedDialog('Identity Server Disconnect Warning', '', QuestionDialog, {
|
||||
title: _t("Disconnect Identity Server"),
|
||||
description:
|
||||
<div>
|
||||
{_t(
|
||||
"Disconnect from the identity server <idserver />?", {},
|
||||
{idserver: sub => <b>{abbreviateUrl(this.state.currentClientIdServer)}</b>},
|
||||
)},
|
||||
</div>,
|
||||
button: _t("Disconnect"),
|
||||
onFinished: (confirmed) => {
|
||||
if (confirmed) {
|
||||
this._disconnectIdServer();
|
||||
}
|
||||
},
|
||||
});
|
||||
_onDisconnectClicked = async () => {
|
||||
this.setState({disconnectBusy: true});
|
||||
try {
|
||||
const threepids = await getThreepidBindStatus(MatrixClientPeg.get());
|
||||
|
||||
const boundThreepids = threepids.filter(tp => tp.bound);
|
||||
let message;
|
||||
if (boundThreepids.length) {
|
||||
message = _t(
|
||||
"You are currently sharing email addresses or phone numbers on the identity " +
|
||||
"server <idserver />. You will need to reconnect to <idserver2 /> to stop " +
|
||||
"sharing them.", {},
|
||||
{
|
||||
idserver: sub => <b>{abbreviateUrl(this.state.currentClientIdServer)}</b>,
|
||||
// XXX: https://github.com/vector-im/riot-web/issues/9086
|
||||
idserver2: sub => <b>{abbreviateUrl(this.state.currentClientIdServer)}</b>,
|
||||
},
|
||||
);
|
||||
} else {
|
||||
message = _t(
|
||||
"Disconnect from the identity server <idserver />?", {},
|
||||
{idserver: sub => <b>{abbreviateUrl(this.state.currentClientIdServer)}</b>},
|
||||
);
|
||||
}
|
||||
|
||||
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||
Modal.createTrackedDialog('Identity Server Disconnect Warning', '', QuestionDialog, {
|
||||
title: _t("Disconnect Identity Server"),
|
||||
description: message,
|
||||
button: _t("Disconnect"),
|
||||
onFinished: (confirmed) => {
|
||||
if (confirmed) {
|
||||
this._disconnectIdServer();
|
||||
}
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
this.setState({disconnectBusy: false});
|
||||
}
|
||||
};
|
||||
|
||||
_disconnectIdServer = () => {
|
||||
|
@ -258,6 +281,11 @@ export default class SetIdServer extends React.Component {
|
|||
|
||||
let discoSection;
|
||||
if (idServerUrl) {
|
||||
let discoButtonContent = _t("Disconnect");
|
||||
if (this.state.disconnectBusy) {
|
||||
const InlineSpinner = sdk.getComponent('views.elements.InlineSpinner');
|
||||
discoButtonContent = <InlineSpinner />;
|
||||
}
|
||||
discoSection = <div>
|
||||
<span className="mx_SettingsTab_subsectionText">{_t(
|
||||
"Disconnecting from your identity server will mean you " +
|
||||
|
@ -265,7 +293,7 @@ export default class SetIdServer extends React.Component {
|
|||
"able to invite others by email or phone.",
|
||||
)}</span>
|
||||
<AccessibleButton onClick={this._onDisconnectClicked} kind="danger">
|
||||
{_t("Disconnect")}
|
||||
{discoButtonContent}
|
||||
</AccessibleButton>
|
||||
</div>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue