From e47752ff8ddc3ab1a008b7b3be77456e5ea6ff5d Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 2 Dec 2019 17:21:53 -0700 Subject: [PATCH 1/2] Match room upgrade warning to the new design See https://github.com/matrix-org/matrix-react-sdk/pull/3684#issuecomment-560514872 --- .../dialogs/_RoomUpgradeWarningDialog.scss | 10 ++- .../views/dialogs/RoomUpgradeWarningDialog.js | 62 ++++++++----------- src/i18n/strings/en_EN.json | 13 ++-- 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/res/css/views/dialogs/_RoomUpgradeWarningDialog.scss b/res/css/views/dialogs/_RoomUpgradeWarningDialog.scss index a40c591f6c..5b9978eba0 100644 --- a/res/css/views/dialogs/_RoomUpgradeWarningDialog.scss +++ b/res/css/views/dialogs/_RoomUpgradeWarningDialog.scss @@ -14,11 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. */ +.mx_RoomUpgradeWarningDialog { + max-width: 38vw; + width: 38vw; +} + .mx_RoomUpgradeWarningDialog .mx_SettingsFlag { + font-weight: 700; + .mx_ToggleSwitch { display: inline-block; vertical-align: middle; - margin-right: 8px; + margin-left: 8px; + float: right; } .mx_SettingsFlag_label { diff --git a/src/components/views/dialogs/RoomUpgradeWarningDialog.js b/src/components/views/dialogs/RoomUpgradeWarningDialog.js index 3a243a2d93..276dcf16be 100644 --- a/src/components/views/dialogs/RoomUpgradeWarningDialog.js +++ b/src/components/views/dialogs/RoomUpgradeWarningDialog.js @@ -53,6 +53,13 @@ export default class RoomUpgradeWarningDialog extends React.Component { this.setState({inviteUsersToNewRoom: newVal}); }; + _openBugReportDialog = (e) => { + e.preventDefault(); + e.stopPropagation(); + + + }; + render() { const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); @@ -61,60 +68,43 @@ export default class RoomUpgradeWarningDialog extends React.Component { if (this.state.isPrivate) { inviteToggle = ( + label={_t("Automatically invite users")} /> ); } + const title = this.state.isPrivate ? _t("Upgrade private room") : _t("Upgrade public room"); + return ( - +
-

{_t("Upgrading a room can be destructive and isn't always necessary.")}

{_t( - "Room upgrades are usually recommended when a room version is considered " + - "unstable. Unstable room versions might have bugs, missing features, or " + - "security vulnerabilities.", - {}, { - "i": (sub) => {sub}, - }, + "Upgrading a room is an advanced action and is usually recommended when a room " + + "is unstable due to bugs, missing features or security vulnerabilities.", )}

{_t( - "Room upgrades usually only affect server-side processing of the " + - "room. If you're having problems with your Riot client, please file an issue " + - "with .", + "This usually only affects how the room is processed on the server. If you're " + + "having problems with your Riot, please report a bug.", {}, { - "i": (sub) => {sub}, - "issueLink": () => { - return - https://github.com/vector-im/riot-web/issues/new/choose - ; + "a": (sub) => { + return {sub}; }, }, )}

{_t( - "Warning: Upgrading a room will not automatically migrate room " + - "members to the new version of the room. 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) => {sub}, - "i": (sub) => {sub}, - }, - )} -

-

- {_t( - "Please confirm that you'd like to go forward with upgrading this room " + - "from to .", + "You'll upgrade this room from to .", {}, { oldVersion: () => {this.state.currentVersion}, @@ -125,7 +115,7 @@ export default class RoomUpgradeWarningDialog extends React.Component { {inviteToggle}

unstable. Unstable room versions might have bugs, missing features, or security vulnerabilities.": "Room upgrades are usually recommended when a room version is considered unstable. Unstable room versions might have bugs, missing features, or security vulnerabilities.", - "Room upgrades usually only affect server-side processing of the room. If you're having problems with your Riot client, please file an issue with .": "Room upgrades usually only affect server-side processing of the room. If you're having problems with your Riot client, please file an issue with .", - "Please confirm that you'd like to go forward with upgrading this room from to .": "Please confirm that you'd like to go forward with upgrading this room from to .", + "Automatically invite users": "Automatically invite users", + "Upgrade private room": "Upgrade private room", + "Upgrade public room": "Upgrade public room", + "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.", + "This usually only affects how the room is processed on the server. If you're having problems with your Riot, please report a bug.": "This usually only affects how the room is processed on the server. If you're having problems with your Riot, please report a bug.", + "You'll upgrade this room from to .": "You'll upgrade this room from to .", + "Upgrade": "Upgrade", "Sign out and remove encryption keys?": "Sign out and remove encryption keys?", "Clear Storage and Sign Out": "Clear Storage and Sign Out", "Send Logs": "Send Logs", From 6d42da8160bf1c3eb30455d80fe6ca5941740e1b Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 2 Dec 2019 17:26:08 -0700 Subject: [PATCH 2/2] Actually spawn a bug report dialog. --- src/SlashCommands.js | 3 ++- src/components/views/dialogs/RoomUpgradeWarningDialog.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/SlashCommands.js b/src/SlashCommands.js index b488fa821b..a9c015fdaf 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -158,7 +158,8 @@ export const CommandMap = { const RoomUpgradeWarningDialog = sdk.getComponent("dialogs.RoomUpgradeWarningDialog"); 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]) => { if (!resp.continue) return; diff --git a/src/components/views/dialogs/RoomUpgradeWarningDialog.js b/src/components/views/dialogs/RoomUpgradeWarningDialog.js index 276dcf16be..4c5a1abf7a 100644 --- a/src/components/views/dialogs/RoomUpgradeWarningDialog.js +++ b/src/components/views/dialogs/RoomUpgradeWarningDialog.js @@ -20,6 +20,7 @@ import {_t} from "../../../languageHandler"; import sdk from "../../../index"; import LabelledToggleSwitch from "../elements/LabelledToggleSwitch"; import MatrixClientPeg from "../../../MatrixClientPeg"; +import Modal from "../../../Modal"; export default class RoomUpgradeWarningDialog extends React.Component { static propTypes = { @@ -57,7 +58,8 @@ export default class RoomUpgradeWarningDialog extends React.Component { e.preventDefault(); e.stopPropagation(); - + const BugReportDialog = sdk.getComponent("dialogs.BugReportDialog"); + Modal.createTrackedDialog('Bug Report Dialog', '', BugReportDialog, {}); }; render() {