From 5ded646db0126f03f2d0db9f498bbd39caeff25d Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 14 Mar 2019 17:03:32 -0600 Subject: [PATCH 1/8] Warn that members won't be autojoined to upgraded rooms Fixes https://github.com/vector-im/riot-web/issues/8173 Wording is questionable though. --- src/components/views/rooms/RoomUpgradeWarningBar.js | 6 ++++++ src/i18n/strings/en_EN.json | 1 + 2 files changed, 7 insertions(+) diff --git a/src/components/views/rooms/RoomUpgradeWarningBar.js b/src/components/views/rooms/RoomUpgradeWarningBar.js index 3a11f46e51..32969cdd3d 100644 --- a/src/components/views/rooms/RoomUpgradeWarningBar.js +++ b/src/components/views/rooms/RoomUpgradeWarningBar.js @@ -72,6 +72,12 @@ module.exports = React.createClass({ return (
{upgradeText} +
+ {_t( + "Members of the room will be required to click a link to join the " + + "new room. No one will be automatically joined or invited to the new room.", + )} +
{_t("Only room administrators will see this warning")}
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 2bda11a1dd..bfb8828fd3 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -581,6 +581,7 @@ "Camera": "Camera", "Voice & Video": "Voice & Video", "This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers", + "Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.": "Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.", "Upgrade room to version %(ver)s": "Upgrade room to version %(ver)s", "Room information": "Room information", "Internal room ID:": "Internal room ID:", From 788041a774b02d20f4c0001db1d15ce2e1975f89 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 14 Mar 2019 17:11:44 -0600 Subject: [PATCH 2/8] Warn that members won't be invited to the new room in room settings --- res/css/views/settings/tabs/_SettingsTab.scss | 4 ++++ .../settings/tabs/room/AdvancedRoomSettingsTab.js | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/res/css/views/settings/tabs/_SettingsTab.scss b/res/css/views/settings/tabs/_SettingsTab.scss index 7fd8bceb50..88735f99b2 100644 --- a/res/css/views/settings/tabs/_SettingsTab.scss +++ b/res/css/views/settings/tabs/_SettingsTab.scss @@ -14,6 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ +.mx_SettingsTab_warningText { + color: $warning-color; +} + .mx_SettingsTab_heading { font-size: 20px; font-weight: 600; diff --git a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js index 3c6a7addc3..13ee39ccd7 100644 --- a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js @@ -67,9 +67,17 @@ export default class AdvancedRoomSettingsTab extends React.Component { let roomUpgradeButton; if (this.state.upgradeRecommendation && this.state.upgradeRecommendation.needsUpgrade) { roomUpgradeButton = ( - - {_t("Upgrade room to version %(ver)s", {ver: this.state.upgradeRecommendation.version})} - +
+

+ {_t( + "Members of the room will be required to click a link to join the new room. No " + + "one will be automatically joined or invited to the new room.", + )} +

+ + {_t("Upgrade room to version %(ver)s", {ver: this.state.upgradeRecommendation.version})} + +
); } From fba4b7235f4766d8f5a08abfd7dc82c0953a3006 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 14 Mar 2019 17:24:22 -0600 Subject: [PATCH 3/8] Add a confirmation prompt when upgrading the room via slashcommand Wording is questionable here, but the idea is to discourage non-power-users from accidentally upgrading their room. They should already be receiving a bunch of warnings if they should consider upgrading in the first place. --- src/SlashCommands.js | 39 ++++++++++++++++++++++++++++++++++++- src/i18n/strings/en_EN.json | 6 +++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/SlashCommands.js b/src/SlashCommands.js index 711346c4a7..11018df081 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -28,6 +28,7 @@ import {MATRIXTO_URL_PATTERN} from "./linkify-matrix"; import * as querystring from "querystring"; import MultiInviter from './utils/MultiInviter'; import { linkifyAndSanitizeHtml } from './HtmlUtils'; +import QuestionDialog from "./components/views/dialogs/QuestionDialog"; class Command { constructor({name, args='', description, runFn, hideCompletionAfterSpace=false}) { @@ -105,7 +106,43 @@ export const CommandMap = { description: _td('Upgrades a room to a new version'), runFn: function(roomId, args) { if (args) { - return success(MatrixClientPeg.get().upgradeRoom(roomId, args)); + const room = MatrixClientPeg.get().getRoom(roomId); + Modal.createTrackedDialog('Slash Commands', 'upgrade room confirmation', + QuestionDialog, { + title: _t('Room upgrade confirmation'), + description: ( +
+ { _t( + "Upgrading your room in this way can be dangerous or unnecessary. Room upgrades " + + "are usually done to change the server's behaviour in a given room and not so much " + + "anything to do with client (Riot) behaviour.", + ) } +
+
+ { _t( + "Members of the room will be required to click a link to join the new room. No " + + "one will be automatically joined or invited to the new room.", + ) } +
+
+ { _t( + "Please confirm that you'd like to go forward with upgrading this room from " + + "%(oldVersion)s to %(newVersion)s", + { + oldVersion: room ? room.getVersion() : "1", + newVersion: args, + }, + ) } +
+ ), + button: _t("Upgrade Room"), + onFinished: (confirm) => { + if (!confirm) return; + + MatrixClientPeg.get().upgradeRoom(roomId, args); + }, + }); + return success(); } return reject(this.getUsage()); }, diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index bfb8828fd3..26113d3d4f 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -132,6 +132,11 @@ "/ddg is not a command": "/ddg is not a command", "To use it, just wait for autocomplete results to load and tab through them.": "To use it, just wait for autocomplete results to load and tab through them.", "Upgrades a room to a new version": "Upgrades a room to a new version", + "Room upgrade confirmation": "Room upgrade confirmation", + "Upgrading your room in this way can be dangerous or unnecessary. Room upgrades are usually done to change the server's behaviour in a given room and not so much anything to do with client (Riot) behaviour.": "Upgrading your room in this way can be dangerous or unnecessary. Room upgrades are usually done to change the server's behaviour in a given room and not so much anything to do with client (Riot) behaviour.", + "Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.": "Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.", + "Please confirm that you'd like to go forward with upgrading this room from %(oldVersion)s to %(newVersion)s": "Please confirm that you'd like to go forward with upgrading this room from %(oldVersion)s to %(newVersion)s", + "Upgrade Room": "Upgrade Room", "Changes your display nickname": "Changes your display nickname", "Changes your display nickname in the current room only": "Changes your display nickname in the current room only", "Changes colour scheme of current room": "Changes colour scheme of current room", @@ -581,7 +586,6 @@ "Camera": "Camera", "Voice & Video": "Voice & Video", "This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers", - "Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.": "Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.", "Upgrade room to version %(ver)s": "Upgrade room to version %(ver)s", "Room information": "Room information", "Internal room ID:": "Internal room ID:", From 92b851b26c4b397cbdd66b615a8a36ae60b31603 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 15 Mar 2019 15:49:18 -0600 Subject: [PATCH 4/8] Update text for room version upgrades in settings --- .../settings/tabs/room/AdvancedRoomSettingsTab.js | 11 ++++++++--- src/i18n/strings/en_EN.json | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js index 13ee39ccd7..8c56e17a13 100644 --- a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js @@ -70,12 +70,17 @@ export default class AdvancedRoomSettingsTab extends React.Component {

{_t( - "Members of the room will be required to click a link to join the new room. No " + - "one will be automatically joined or invited to the new room.", + "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("Upgrade room to version %(ver)s", {ver: this.state.upgradeRecommendation.version})} + {_t("Upgrade this room to the recommended room version")}
); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index d450e92d71..a49fc485fe 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -586,7 +586,8 @@ "Camera": "Camera", "Voice & Video": "Voice & Video", "This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers", - "Upgrade room to version %(ver)s": "Upgrade room to version %(ver)s", + "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.": "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.", + "Upgrade this room to the recommended room version": "Upgrade this room to the recommended room version", "Room information": "Room information", "Internal room ID:": "Internal room ID:", "Room version": "Room version", From f6e3437944d781e4cb9bd0d3934568c5c026c281 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 15 Mar 2019 16:00:34 -0600 Subject: [PATCH 5/8] Update text in RoomUpgradeWarningBar to match suggestions --- .../views/rooms/_RoomUpgradeWarningBar.scss | 2 +- .../views/rooms/RoomUpgradeWarningBar.js | 66 +++++++++---------- src/i18n/strings/en_EN.json | 3 +- 3 files changed, 34 insertions(+), 37 deletions(-) diff --git a/res/css/views/rooms/_RoomUpgradeWarningBar.scss b/res/css/views/rooms/_RoomUpgradeWarningBar.scss index 82785b82d2..fe81d3801a 100644 --- a/res/css/views/rooms/_RoomUpgradeWarningBar.scss +++ b/res/css/views/rooms/_RoomUpgradeWarningBar.scss @@ -16,7 +16,7 @@ limitations under the License. .mx_RoomUpgradeWarningBar { text-align: center; - height: 176px; + height: 235px; background-color: $event-selected-color; align-items: center; flex-direction: column; diff --git a/src/components/views/rooms/RoomUpgradeWarningBar.js b/src/components/views/rooms/RoomUpgradeWarningBar.js index 32969cdd3d..589608dcfa 100644 --- a/src/components/views/rooms/RoomUpgradeWarningBar.js +++ b/src/components/views/rooms/RoomUpgradeWarningBar.js @@ -37,47 +37,43 @@ module.exports = React.createClass({ render: function() { const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); - let upgradeText = ( -
+ return ( +
+
+ {_t( + "This room is running room version , which this homeserver has " + + "marked as unstable.", + {}, + { + "roomVersion": () => {this.props.room.getVersion()}, + "i": (sub) => {sub}, + }, + )} +
- {_t("This room is using an unstable room version. If you aren't expecting " + - "this, please upgrade the room.")} +

+ {_t( + "Upgrading this room will shut down the current instance of the room and create " + + "an upgraded room with the same name.", + )} +

+

+ {_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("Click here to upgrade to the latest room version.")} + {_t("Upgrade this room to the recommended room version")}

-
- ); - if (this.props.recommendation.urgent) { - upgradeText = ( -
-
- {_t("There is a known vulnerability affecting this room.")} -
-
- {_t("This room version is vulnerable to malicious modification of room state.")} -
-

- - {_t("Click here to upgrade to the latest room version and ensure room integrity " + - "is protected.")} - -

-
- ); - } - - return ( -
- {upgradeText} -
- {_t( - "Members of the room will be required to click a link to join the " + - "new room. No one will be automatically joined or invited to the new room.", - )} -
{_t("Only room administrators will see this warning")}
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index a49fc485fe..976f902f27 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -812,7 +812,8 @@ "Click here to upgrade to the latest room version.": "Click here to upgrade to the latest room version.", "There is a known vulnerability affecting this room.": "There is a known vulnerability affecting this room.", "This room version is vulnerable to malicious modification of room state.": "This room version is vulnerable to malicious modification of room state.", - "Click here to upgrade to the latest room version and ensure room integrity is protected.": "Click here to upgrade to the latest room version and ensure room integrity is protected.", + "This room is running room version , which this homeserver has marked as unstable.": "This room is running room version , which this homeserver has marked as unstable.", + "Upgrading this room will shut down the current instance of the room and create an upgraded room with the same name.": "Upgrading this room will shut down the current instance of the room and create an upgraded room with the same name.", "Only room administrators will see this warning": "Only room administrators will see this warning", "This Room": "This Room", "All Rooms": "All Rooms", From 4777f851f8e282bd4cfa56203e5a44223141bca4 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 15 Mar 2019 16:08:48 -0600 Subject: [PATCH 6/8] Update text for /upgraderoom to match suggestions --- src/SlashCommands.js | 73 ++++++++++++++++++++++++++----------- src/i18n/strings/en_EN.json | 17 ++++----- 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/src/SlashCommands.js b/src/SlashCommands.js index 11018df081..dc653b45ab 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -112,30 +112,59 @@ export const CommandMap = { title: _t('Room upgrade confirmation'), description: (
- { _t( - "Upgrading your room in this way can be dangerous or unnecessary. Room upgrades " + - "are usually done to change the server's behaviour in a given room and not so much " + - "anything to do with client (Riot) behaviour.", - ) } -
-
- { _t( - "Members of the room will be required to click a link to join the new room. No " + - "one will be automatically joined or invited to the new room.", - ) } -
-
- { _t( - "Please confirm that you'd like to go forward with upgrading this room from " + - "%(oldVersion)s to %(newVersion)s", - { - oldVersion: room ? room.getVersion() : "1", - newVersion: args, - }, - ) } +

{_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}, + }, + )} +

+

+ {_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 .", + {}, { + "i": (sub) => {sub}, + "issueLink": () => { + return + https://github.com/vector-im/riot-web/issues/new/choose + ; + }, + } + )} +

+

+ {_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 ", + {}, + { + oldVersion: () => {room ? room.getVersion() : "1"}, + newVersion: () => {args}, + }, + )} +

), - button: _t("Upgrade Room"), + button: _t("Upgrade"), onFinished: (confirm) => { if (!confirm) return; diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 976f902f27..ef4bc75d27 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -133,10 +133,12 @@ "To use it, just wait for autocomplete results to load and tab through them.": "To use it, just wait for autocomplete results to load and tab through them.", "Upgrades a room to a new version": "Upgrades a room to a new version", "Room upgrade confirmation": "Room upgrade confirmation", - "Upgrading your room in this way can be dangerous or unnecessary. Room upgrades are usually done to change the server's behaviour in a given room and not so much anything to do with client (Riot) behaviour.": "Upgrading your room in this way can be dangerous or unnecessary. Room upgrades are usually done to change the server's behaviour in a given room and not so much anything to do with client (Riot) behaviour.", - "Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.": "Members of the room will be required to click a link to join the new room. No one will be automatically joined or invited to the new room.", - "Please confirm that you'd like to go forward with upgrading this room from %(oldVersion)s to %(newVersion)s": "Please confirm that you'd like to go forward with upgrading this room from %(oldVersion)s to %(newVersion)s", - "Upgrade Room": "Upgrade Room", + "Upgrading a room can be destructive and isn't always necessary.": "Upgrading a room can be destructive and isn't always necessary.", + "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 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 .", + "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.": "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.", + "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 ", + "Upgrade": "Upgrade", "Changes your display nickname": "Changes your display nickname", "Changes your display nickname in the current room only": "Changes your display nickname in the current room only", "Changes colour scheme of current room": "Changes colour scheme of current room", @@ -586,7 +588,6 @@ "Camera": "Camera", "Voice & Video": "Voice & Video", "This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers", - "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.": "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.", "Upgrade this room to the recommended room version": "Upgrade this room to the recommended room version", "Room information": "Room information", "Internal room ID:": "Internal room ID:", @@ -808,11 +809,7 @@ "Not now": "Not now", "Don't ask me again": "Don't ask me again", "Add a topic": "Add a topic", - "This room is using an unstable room version. If you aren't expecting this, please upgrade the room.": "This room is using an unstable room version. If you aren't expecting this, please upgrade the room.", - "Click here to upgrade to the latest room version.": "Click here to upgrade to the latest room version.", - "There is a known vulnerability affecting this room.": "There is a known vulnerability affecting this room.", - "This room version is vulnerable to malicious modification of room state.": "This room version is vulnerable to malicious modification of room state.", - "This room is running room version , which this homeserver has marked as unstable.": "This room is running room version , which this homeserver has marked as unstable.", + "This room is running room version , which this homeserver has marked as unstable.": "This room is running room version , which this homeserver has marked as unstable.", "Upgrading this room will shut down the current instance of the room and create an upgraded room with the same name.": "Upgrading this room will shut down the current instance of the room and create an upgraded room with the same name.", "Only room administrators will see this warning": "Only room administrators will see this warning", "This Room": "This Room", From 7504927ed9303f98cce59cab52330c64ce5053ba Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 15 Mar 2019 16:37:32 -0600 Subject: [PATCH 7/8] Appease the linter --- src/SlashCommands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SlashCommands.js b/src/SlashCommands.js index dc653b45ab..039ccb928f 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -136,7 +136,7 @@ export const CommandMap = { https://github.com/vector-im/riot-web/issues/new/choose ; }, - } + }, )}

From 27c9b24cab605c599fba046447b2d4c15697b087 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 15 Mar 2019 16:44:27 -0600 Subject: [PATCH 8/8] Appease more of the linter --- .../views/settings/tabs/room/AdvancedRoomSettingsTab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js index 8c56e17a13..cabc196e40 100644 --- a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js @@ -71,8 +71,8 @@ export default class AdvancedRoomSettingsTab extends React.Component {

{_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.", + "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},