From 79d467c551c1ebaf60abed2375f9b29be0563046 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 24 Oct 2018 17:36:58 +0100 Subject: [PATCH 1/8] Add button to open devtools in roomsettings --- src/components/views/rooms/RoomSettings.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 46869c1773..23c2dbc93d 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -590,6 +590,11 @@ module.exports = React.createClass({ } }, + _openDevtools: function() { + const DevtoolsDialog = sdk.getComponent('dialogs.DevtoolsDialog'); + Modal.createDialog(DevtoolsDialog, {roomId: this.props.room.roomId}); + }, + _renderEncryptionSection: function() { const SettingsFlag = sdk.getComponent("elements.SettingsFlag"); @@ -942,6 +947,10 @@ module.exports = React.createClass({ ; } + devtoolsButton = + { _t("Open Devtools") } + ; + return (
@@ -1055,6 +1064,7 @@ module.exports = React.createClass({ { _t('Internal room ID: ') } { this.props.room.roomId }
{ _t('Room version number: ') } { this.props.room.getVersion() }
{ roomUpgradeButton } + { devtoolsButton }
); From 06c34cff9c2e7dddca4b69f2826dfbd3b218a3d7 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 24 Oct 2018 17:37:13 +0100 Subject: [PATCH 2/8] Add devtools string --- src/i18n/strings/en_EN.json | 3 ++- src/i18n/strings/en_US.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 2885eb68a7..cbb688f448 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1268,5 +1268,6 @@ "Import": "Import", "Failed to set direct chat tag": "Failed to set direct chat tag", "Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room", - "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room" + "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room", + "Open Devtools": "Open Devtools", } diff --git a/src/i18n/strings/en_US.json b/src/i18n/strings/en_US.json index d8733ab05a..9146fdf586 100644 --- a/src/i18n/strings/en_US.json +++ b/src/i18n/strings/en_US.json @@ -838,5 +838,6 @@ "Your homeserver's URL": "Your homeserver's URL", "Your identity server's URL": "Your identity server's URL", "e.g. %(exampleValue)s": "e.g. %(exampleValue)s", - "Every page you use in the app": "Every page you use in the app" + "Every page you use in the app": "Every page you use in the app", + "Open Devtools": "Open Devtools" } From 44a41b589d55a3cb8cbc7828353ddc75ad3f2a13 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 24 Oct 2018 17:50:15 +0100 Subject: [PATCH 3/8] Comma on strings and styling button --- res/css/views/rooms/_RoomSettings.scss | 7 +++++++ src/components/views/rooms/RoomSettings.js | 2 +- src/i18n/strings/en_EN.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/res/css/views/rooms/_RoomSettings.scss b/res/css/views/rooms/_RoomSettings.scss index f04042ea77..b3858f3ba7 100644 --- a/res/css/views/rooms/_RoomSettings.scss +++ b/res/css/views/rooms/_RoomSettings.scss @@ -28,6 +28,13 @@ limitations under the License. margin-right: 8px; } +.mx_RoomSettings_devtoolsButton { + @mixin mx_DialogButton; + position: relative; + padding: 4px 1.5em; + margin-top: 8px; +} + .mx_RoomSettings_upgradeButton, .mx_RoomSettings_leaveButton:hover, .mx_RoomSettings_unbanButton:hover { diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 23c2dbc93d..774d136e45 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -947,7 +947,7 @@ module.exports = React.createClass({ ; } - devtoolsButton = + const devtoolsButton = { _t("Open Devtools") } ; diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index cbb688f448..45fb0351a7 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1269,5 +1269,5 @@ "Failed to set direct chat tag": "Failed to set direct chat tag", "Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room", "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room", - "Open Devtools": "Open Devtools", + "Open Devtools": "Open Devtools" } From 3c045f3f65f4940889d1a646fafeb85f544173fb Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 24 Oct 2018 18:02:45 +0100 Subject: [PATCH 4/8] Revert i18n changes for en_US --- src/i18n/strings/en_US.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/i18n/strings/en_US.json b/src/i18n/strings/en_US.json index 9146fdf586..d8733ab05a 100644 --- a/src/i18n/strings/en_US.json +++ b/src/i18n/strings/en_US.json @@ -838,6 +838,5 @@ "Your homeserver's URL": "Your homeserver's URL", "Your identity server's URL": "Your identity server's URL", "e.g. %(exampleValue)s": "e.g. %(exampleValue)s", - "Every page you use in the app": "Every page you use in the app", - "Open Devtools": "Open Devtools" + "Every page you use in the app": "Every page you use in the app" } From a5ae599dcb819c0c919af61065d998c652934bb4 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 24 Oct 2018 18:15:25 +0100 Subject: [PATCH 5/8] Add show developer tools option --- src/settings/Settings.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/settings/Settings.js b/src/settings/Settings.js index 021942c6f2..547c71bac8 100644 --- a/src/settings/Settings.js +++ b/src/settings/Settings.js @@ -290,4 +290,9 @@ export const SETTINGS = { displayName: _td('Show empty room list headings'), default: true, }, + "showDeveloperTools": { + supportedLevels: LEVELS_ACCOUNT_SETTINGS, + displayName: _td('Show developer tools'), + default: false, + }, }; From 8118a9c71a394665a1497e9408d9a2b6d54fb1d5 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 24 Oct 2018 18:15:35 +0100 Subject: [PATCH 6/8] Wall devtools button behind a setting --- src/components/views/rooms/RoomSettings.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 774d136e45..b69938a117 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -947,9 +947,10 @@ module.exports = React.createClass({ ; } - const devtoolsButton = + const devtoolsButton = SettingsStore.getValue("showDeveloperTools") ? + ( { _t("Open Devtools") } - ; + ) : null; return (
From 27a0f0ca62ab93b2390556003406fdc9f98434e0 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 24 Oct 2018 18:16:55 +0100 Subject: [PATCH 7/8] Add i18n string --- src/i18n/strings/en_EN.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 45fb0351a7..8e1f75f25c 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1269,5 +1269,6 @@ "Failed to set direct chat tag": "Failed to set direct chat tag", "Failed to remove tag %(tagName)s from room": "Failed to remove tag %(tagName)s from room", "Failed to add tag %(tagName)s to room": "Failed to add tag %(tagName)s to room", - "Open Devtools": "Open Devtools" + "Open Devtools": "Open Devtools", + "Show developer tools": "Show developer tools" } From def0b2d8fb393bfa027b605f04b4ebc819763a92 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 24 Oct 2018 18:20:16 +0100 Subject: [PATCH 8/8] Add developertools option to UserSettings --- src/components/structures/UserSettings.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 129278907f..f32026511b 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -82,6 +82,7 @@ const SIMPLE_SETTINGS = [ { id: "TagPanel.disableTagPanel" }, { id: "enableWidgetScreenshots" }, { id: "RoomSubList.showEmpty" }, + { id: "showDeveloperTools" }, ]; // These settings must be defined in SettingsStore