Merge remote-tracking branch 'origin/dbkr/fix_session_restore_fail_dialog_ux' into dbkr/bug_report_dialog_basedialog

This commit is contained in:
David Baker 2018-04-30 16:20:12 +01:00
commit 025bffb4e9
2 changed files with 19 additions and 13 deletions

View file

@ -44,9 +44,9 @@ export default React.createClass({
// Whether the dialog should have a 'close' button that will // Whether the dialog should have a 'close' button that will
// cause the dialog to be cancelled. This should only be set // cause the dialog to be cancelled. This should only be set
// to true if there is nothing the app can sensibly do if the // to false if there is nothing the app can sensibly do if the
// dialog is cancelled, eg. "We can't restore your session and // dialog is cancelled, eg. "We can't restore your session and
// the app cannot work". // the app cannot work". Default: true.
hasCancel: PropTypes.bool, hasCancel: PropTypes.bool,
// called when a key is pressed // called when a key is pressed

View file

@ -58,6 +58,12 @@ export default React.createClass({
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
const clearStorageButton = (
<button onClick={this._onClearStorageClick} className="danger">
{ _t("Clear Storage and Sign Out") }
</button>
);
let dialogButtons; let dialogButtons;
if (SdkConfig.get().bug_report_endpoint_url) { if (SdkConfig.get().bug_report_endpoint_url) {
dialogButtons = <DialogButtons primaryButton={_t("Send Logs")} dialogButtons = <DialogButtons primaryButton={_t("Send Logs")}
@ -65,9 +71,7 @@ export default React.createClass({
focus={true} focus={true}
hasCancel={false} hasCancel={false}
> >
<button onClick={this._onClearStorageClick} className="danger"> { clearStorageButton }
{ _t("Clear Storage and Sign Out") }
</button>
</DialogButtons>; </DialogButtons>;
} else { } else {
dialogButtons = <DialogButtons primaryButton={_t("Refresh")} dialogButtons = <DialogButtons primaryButton={_t("Refresh")}
@ -75,9 +79,7 @@ export default React.createClass({
focus={true} focus={true}
hasCancel={false} hasCancel={false}
> >
<button onClick={this._onClearStorageClick} className="danger"> { clearStorageButton }
{ _t("Clear Storage and Sign Out") }
</button>
</DialogButtons>; </DialogButtons>;
} }
@ -90,12 +92,16 @@ export default React.createClass({
<div className="mx_Dialog_content" id='mx_Dialog_content'> <div className="mx_Dialog_content" id='mx_Dialog_content'>
<p>{ _t("We encountered an error trying to restore your previous session.") }</p> <p>{ _t("We encountered an error trying to restore your previous session.") }</p>
<p>{ _t("If you have previously used a more recent version of Riot, your session " + <p>{ _t(
"may be incompatible with this version. Close this window and return " + "If you have previously used a more recent version of Riot, your session " +
"to the more recent version.") }</p> "may be incompatible with this version. Close this window and return " +
"to the more recent version.",
) }</p>
<p>{ _t("Clearing your browser's storage may fix the problem, but will sign you " + <p>{ _t(
"out and cause any encrypted chat history to become unreadable.") }</p> "Clearing your browser's storage may fix the problem, but will sign you " +
"out and cause any encrypted chat history to become unreadable.",
) }</p>
</div> </div>
{ dialogButtons } { dialogButtons }
</BaseDialog> </BaseDialog>