2017-02-15 21:44:15 +03:00
|
|
|
/*
|
|
|
|
Copyright 2017 Vector Creations Ltd
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
2017-12-26 04:03:18 +03:00
|
|
|
import PropTypes from 'prop-types';
|
2017-02-15 21:44:15 +03:00
|
|
|
import sdk from '../../../index';
|
|
|
|
import SdkConfig from '../../../SdkConfig';
|
|
|
|
import Modal from '../../../Modal';
|
2017-11-13 22:19:33 +03:00
|
|
|
import { _t } from '../../../languageHandler';
|
2017-02-15 21:44:15 +03:00
|
|
|
|
|
|
|
|
|
|
|
export default React.createClass({
|
|
|
|
displayName: 'SessionRestoreErrorDialog',
|
|
|
|
|
|
|
|
propTypes: {
|
2017-12-26 04:03:18 +03:00
|
|
|
error: PropTypes.string.isRequired,
|
|
|
|
onFinished: PropTypes.func.isRequired,
|
2017-02-15 21:44:15 +03:00
|
|
|
},
|
|
|
|
|
2017-12-05 15:52:20 +03:00
|
|
|
componentDidMount: function() {
|
|
|
|
if (this.refs.bugreportLink) {
|
|
|
|
this.refs.bugreportLink.focus();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-02-15 21:44:15 +03:00
|
|
|
_sendBugReport: function() {
|
|
|
|
const BugReportDialog = sdk.getComponent("dialogs.BugReportDialog");
|
2017-07-27 19:19:18 +03:00
|
|
|
Modal.createTrackedDialog('Session Restore Error', 'Send Bug Report Dialog', BugReportDialog, {});
|
2017-02-15 21:44:15 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
_continueClicked: function() {
|
|
|
|
this.props.onFinished(true);
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
2017-12-23 06:44:32 +03:00
|
|
|
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
2017-02-15 21:44:15 +03:00
|
|
|
let bugreport;
|
|
|
|
|
|
|
|
if (SdkConfig.get().bug_report_endpoint_url) {
|
|
|
|
bugreport = (
|
2017-06-08 14:33:29 +03:00
|
|
|
<p>
|
2017-11-13 22:19:33 +03:00
|
|
|
{ _t(
|
2017-06-08 14:33:29 +03:00
|
|
|
"Otherwise, <a>click here</a> to send a bug report.",
|
2017-11-13 22:19:33 +03:00
|
|
|
{},
|
2017-12-08 09:47:08 +03:00
|
|
|
{ 'a': (sub) => <a ref="bugreportLink" onClick={this._sendBugReport}
|
|
|
|
key="bugreport" href='#'>{ sub }</a> },
|
2017-09-28 13:21:06 +03:00
|
|
|
) }
|
2017-02-15 21:44:15 +03:00
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
2017-12-14 12:31:28 +03:00
|
|
|
const shouldFocusContinueButton =!(bugreport==true);
|
2017-02-15 21:44:15 +03:00
|
|
|
|
|
|
|
return (
|
|
|
|
<BaseDialog className="mx_ErrorDialog" onFinished={this.props.onFinished}
|
2017-12-05 15:52:20 +03:00
|
|
|
title={_t('Unable to restore session')}
|
|
|
|
contentId='mx_Dialog_content'
|
|
|
|
>
|
|
|
|
<div className="mx_Dialog_content" id='mx_Dialog_content'>
|
2017-09-28 13:21:06 +03:00
|
|
|
<p>{ _t("We encountered an error trying to restore your previous session. If " +
|
2017-05-30 17:09:57 +03:00
|
|
|
"you continue, you will need to log in again, and encrypted chat " +
|
2017-09-28 13:21:06 +03:00
|
|
|
"history will be unreadable.") }</p>
|
2017-02-15 21:44:15 +03:00
|
|
|
|
2017-09-28 13:21:06 +03:00
|
|
|
<p>{ _t("If you have previously used a more recent version of Riot, your session " +
|
2017-05-30 17:09:57 +03:00
|
|
|
"may be incompatible with this version. Close this window and return " +
|
2017-09-28 13:21:06 +03:00
|
|
|
"to the more recent version.") }</p>
|
2017-02-15 21:44:15 +03:00
|
|
|
|
2017-09-28 13:21:06 +03:00
|
|
|
{ bugreport }
|
2017-02-15 21:44:15 +03:00
|
|
|
</div>
|
2017-12-23 06:44:32 +03:00
|
|
|
<DialogButtons primaryButton={_t("Continue anyway")}
|
2018-02-07 01:04:15 +03:00
|
|
|
onPrimaryButtonClick={this._continueClicked} focus={shouldFocusContinueButton}
|
2017-12-23 06:44:32 +03:00
|
|
|
onCancel={this.props.onFinished} />
|
2017-02-15 21:44:15 +03:00
|
|
|
</BaseDialog>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|