Merge pull request #3695 from matrix-org/travis/new-upgrade-dialog

Match room upgrade warning to the new design
pull/21833/head
David Baker 2019-12-04 10:17:33 +00:00 committed by GitHub
commit 2058ba8fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 44 deletions

View File

@ -14,11 +14,19 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
.mx_RoomUpgradeWarningDialog {
max-width: 38vw;
width: 38vw;
}
.mx_RoomUpgradeWarningDialog .mx_SettingsFlag { .mx_RoomUpgradeWarningDialog .mx_SettingsFlag {
font-weight: 700;
.mx_ToggleSwitch { .mx_ToggleSwitch {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
margin-right: 8px; margin-left: 8px;
float: right;
} }
.mx_SettingsFlag_label { .mx_SettingsFlag_label {

View File

@ -158,7 +158,8 @@ export const CommandMap = {
const RoomUpgradeWarningDialog = sdk.getComponent("dialogs.RoomUpgradeWarningDialog"); const RoomUpgradeWarningDialog = sdk.getComponent("dialogs.RoomUpgradeWarningDialog");
const {finished} = Modal.createTrackedDialog('Slash Commands', 'upgrade room confirmation', const {finished} = Modal.createTrackedDialog('Slash Commands', 'upgrade room confirmation',
RoomUpgradeWarningDialog, {roomId: roomId, targetVersion: args}); RoomUpgradeWarningDialog, {roomId: roomId, targetVersion: args}, /*className=*/null,
/*isPriority=*/false, /*isStatic=*/true);
return success(finished.then(async ([resp]) => { return success(finished.then(async ([resp]) => {
if (!resp.continue) return; if (!resp.continue) return;

View File

@ -20,6 +20,7 @@ import {_t} from "../../../languageHandler";
import sdk from "../../../index"; import sdk from "../../../index";
import LabelledToggleSwitch from "../elements/LabelledToggleSwitch"; import LabelledToggleSwitch from "../elements/LabelledToggleSwitch";
import MatrixClientPeg from "../../../MatrixClientPeg"; import MatrixClientPeg from "../../../MatrixClientPeg";
import Modal from "../../../Modal";
export default class RoomUpgradeWarningDialog extends React.Component { export default class RoomUpgradeWarningDialog extends React.Component {
static propTypes = { static propTypes = {
@ -53,6 +54,14 @@ export default class RoomUpgradeWarningDialog extends React.Component {
this.setState({inviteUsersToNewRoom: newVal}); this.setState({inviteUsersToNewRoom: newVal});
}; };
_openBugReportDialog = (e) => {
e.preventDefault();
e.stopPropagation();
const BugReportDialog = sdk.getComponent("dialogs.BugReportDialog");
Modal.createTrackedDialog('Bug Report Dialog', '', BugReportDialog, {});
};
render() { render() {
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');
@ -61,60 +70,43 @@ export default class RoomUpgradeWarningDialog extends React.Component {
if (this.state.isPrivate) { if (this.state.isPrivate) {
inviteToggle = ( inviteToggle = (
<LabelledToggleSwitch <LabelledToggleSwitch
value={this.state.inviteUsersToNewRoom} toggleInFront={true} value={this.state.inviteUsersToNewRoom}
onChange={this._onInviteUsersToggle} onChange={this._onInviteUsersToggle}
label={_t("Invite joined members to the new room automatically")} /> label={_t("Automatically invite users")} />
); );
} }
const title = this.state.isPrivate ? _t("Upgrade private room") : _t("Upgrade public room");
return ( return (
<BaseDialog className='mx_RoomUpgradeWarningDialog' hasCancel={true} <BaseDialog
onFinished={this.props.onFinished} className='mx_RoomUpgradeWarningDialog'
title={_t("Room upgrade confirmation")}> hasCancel={true}
fixedWidth={false}
onFinished={this.props.onFinished}
title={title}
>
<div> <div>
<p>{_t("Upgrading a room can be destructive and isn't always necessary.")}</p>
<p> <p>
{_t( {_t(
"Room upgrades are usually recommended when a room version is considered " + "Upgrading a room is an advanced action and is usually recommended when a room " +
"<i>unstable</i>. Unstable room versions might have bugs, missing features, or " + "is unstable due to bugs, missing features or security vulnerabilities.",
"security vulnerabilities.",
{}, {
"i": (sub) => <i>{sub}</i>,
},
)} )}
</p> </p>
<p> <p>
{_t( {_t(
"Room upgrades usually only affect <i>server-side</i> processing of the " + "This usually only affects how the room is processed on the server. If you're " +
"room. If you're having problems with your Riot client, please file an issue " + "having problems with your Riot, please <a>report a bug</a>.",
"with <issueLink />.",
{}, { {}, {
"i": (sub) => <i>{sub}</i>, "a": (sub) => {
"issueLink": () => { return <a href='#' onClick={this._openBugReportDialog}>{sub}</a>;
return <a href="https://github.com/vector-im/riot-web/issues/new/choose"
target="_blank" rel="noopener">
https://github.com/vector-im/riot-web/issues/new/choose
</a>;
}, },
}, },
)} )}
</p> </p>
<p> <p>
{_t( {_t(
"<b>Warning</b>: Upgrading a room will <i>not automatically migrate room " + "You'll upgrade this room from <oldVersion /> to <newVersion />.",
"members to the new version of the room.</i> We'll post a link to the new room " +
"in the old version of the room - room members will have to click this link to " +
"join the new room.",
{}, {
"b": (sub) => <b>{sub}</b>,
"i": (sub) => <i>{sub}</i>,
},
)}
</p>
<p>
{_t(
"Please confirm that you'd like to go forward with upgrading this room " +
"from <oldVersion /> to <newVersion />.",
{}, {},
{ {
oldVersion: () => <code>{this.state.currentVersion}</code>, oldVersion: () => <code>{this.state.currentVersion}</code>,
@ -125,7 +117,7 @@ export default class RoomUpgradeWarningDialog extends React.Component {
{inviteToggle} {inviteToggle}
</div> </div>
<DialogButtons <DialogButtons
primaryButton={_t("Continue")} primaryButton={_t("Upgrade")}
onPrimaryButtonClick={this._onContinue} onPrimaryButtonClick={this._onContinue}
cancelButton={_t("Cancel")} cancelButton={_t("Cancel")}
onCancel={this._onCancel} onCancel={this._onCancel}

View File

@ -1431,12 +1431,13 @@
"Update any local room aliases to point to the new room": "Update any local room aliases to point to the new room", "Update any local room aliases to point to the new room": "Update any local room aliases to point to the new room",
"Stop users from speaking in the old version of the room, and post a message advising users to move to the new room": "Stop users from speaking in the old version of the room, and post a message advising users to move to the new room", "Stop users from speaking in the old version of the room, and post a message advising users to move to the new room": "Stop users from speaking in the old version of the room, and post a message advising users to move to the new room",
"Put a link back to the old room at the start of the new room so people can see old messages": "Put a link back to the old room at the start of the new room so people can see old messages", "Put a link back to the old room at the start of the new room so people can see old messages": "Put a link back to the old room at the start of the new room so people can see old messages",
"Invite joined members to the new room automatically": "Invite joined members to the new room automatically", "Automatically invite users": "Automatically invite users",
"Room upgrade confirmation": "Room upgrade confirmation", "Upgrade private room": "Upgrade private room",
"Upgrading a room can be destructive and isn't always necessary.": "Upgrading a room can be destructive and isn't always necessary.", "Upgrade public room": "Upgrade public room",
"Room upgrades are usually recommended when a room version is considered <i>unstable</i>. Unstable room versions might have bugs, missing features, or security vulnerabilities.": "Room upgrades are usually recommended when a room version is considered <i>unstable</i>. Unstable room versions might have bugs, missing features, or security vulnerabilities.", "Upgrading a room is an advanced action and is usually recommended when a room is unstable due to bugs, missing features or security vulnerabilities.": "Upgrading a room is an advanced action and is usually recommended when a room is unstable due to bugs, missing features or security vulnerabilities.",
"Room upgrades usually only affect <i>server-side</i> processing of the room. If you're having problems with your Riot client, please file an issue with <issueLink />.": "Room upgrades usually only affect <i>server-side</i> processing of the room. If you're having problems with your Riot client, please file an issue with <issueLink />.", "This usually only affects how the room is processed on the server. If you're having problems with your Riot, please <a>report a bug</a>.": "This usually only affects how the room is processed on the server. If you're having problems with your Riot, please <a>report a bug</a>.",
"Please confirm that you'd like to go forward with upgrading this room from <oldVersion /> to <newVersion />.": "Please confirm that you'd like to go forward with upgrading this room from <oldVersion /> to <newVersion />.", "You'll upgrade this room from <oldVersion /> to <newVersion />.": "You'll upgrade this room from <oldVersion /> to <newVersion />.",
"Upgrade": "Upgrade",
"Sign out and remove encryption keys?": "Sign out and remove encryption keys?", "Sign out and remove encryption keys?": "Sign out and remove encryption keys?",
"Clear Storage and Sign Out": "Clear Storage and Sign Out", "Clear Storage and Sign Out": "Clear Storage and Sign Out",
"Send Logs": "Send Logs", "Send Logs": "Send Logs",