From 15d10042eeba2c608a334fbb8d70885fd6733af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 22 Dec 2020 08:52:21 +0100 Subject: [PATCH 1/8] Fixed 16014 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- .../room_settings/RoomProfileSettings.js | 60 +++++++++++-------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/src/components/views/room_settings/RoomProfileSettings.js b/src/components/views/room_settings/RoomProfileSettings.js index ca09c3093a..f08860d52b 100644 --- a/src/components/views/room_settings/RoomProfileSettings.js +++ b/src/components/views/room_settings/RoomProfileSettings.js @@ -120,17 +120,21 @@ export default class RoomProfileSettings extends React.Component { }; _onDisplayNameChanged = (e) => { - this.setState({ - displayName: e.target.value, - enableProfileSave: true, - }); + this.setState({displayName: e.target.value}); + if (this.state.originalDisplayName === e.target.value) { + this.setState({enableProfileSave: false}); + } else { + this.setState({enableProfileSave: true}); + } }; _onTopicChanged = (e) => { - this.setState({ - topic: e.target.value, - enableProfileSave: true, - }); + this.setState({topic: e.target.value}); + if (this.state.originalTopic === e.target.value) { + this.setState({enableProfileSave: false}); + } else { + this.setState({enableProfileSave: true}); + } }; _onAvatarChanged = (e) => { @@ -158,6 +162,29 @@ export default class RoomProfileSettings extends React.Component { render() { const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); const AvatarSetting = sdk.getComponent('settings.AvatarSetting'); + + let profileSettingsButtons; + if (this.state.enableProfileSave) { + profileSettingsButtons = ( +
+ + {_t("Cancel")} + + + {_t("Save")} + +
+ ); + } + return (
-
- - {_t("Cancel")} - - - {_t("Save")} - -
+ { profileSettingsButtons }
); } From 48cfd3f9da5b8200a902dad94e061666180e9fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 22 Dec 2020 09:29:35 +0100 Subject: [PATCH 2/8] Fixed some avatar stuff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/room_settings/RoomProfileSettings.js | 1 + src/components/views/settings/AvatarSetting.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/views/room_settings/RoomProfileSettings.js b/src/components/views/room_settings/RoomProfileSettings.js index f08860d52b..ccbe8e288a 100644 --- a/src/components/views/room_settings/RoomProfileSettings.js +++ b/src/components/views/room_settings/RoomProfileSettings.js @@ -62,6 +62,7 @@ export default class RoomProfileSettings extends React.Component { } _uploadAvatar = () => { + if (!this.state.canSetAvatar) return; this._avatarUpload.current.click(); }; diff --git a/src/components/views/settings/AvatarSetting.js b/src/components/views/settings/AvatarSetting.js index 487c752c38..93b982467a 100644 --- a/src/components/views/settings/AvatarSetting.js +++ b/src/components/views/settings/AvatarSetting.js @@ -65,7 +65,7 @@ const AvatarSetting = ({avatarUrl, avatarAltText, avatarName, uploadAvatar, remo const avatarClasses = classNames({ "mx_AvatarSetting_avatar": true, - "mx_AvatarSetting_avatar_hovering": isHovering, + "mx_AvatarSetting_avatar_hovering": isHovering && uploadAvatar, }); return
{avatarElement} From ffe2727cf72e2fe305e532a2b70dc904744f5910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 22 Dec 2020 09:40:39 +0100 Subject: [PATCH 3/8] Fixed topic field resizing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- res/css/views/settings/_ProfileSettings.scss | 6 ++++++ src/components/views/room_settings/RoomProfileSettings.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/res/css/views/settings/_ProfileSettings.scss b/res/css/views/settings/_ProfileSettings.scss index 732cbedf02..4cbcb8e708 100644 --- a/res/css/views/settings/_ProfileSettings.scss +++ b/res/css/views/settings/_ProfileSettings.scss @@ -14,6 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ +.mx_ProfileSettings_controls_topic { + & > textarea { + resize: vertical; + } +} + .mx_ProfileSettings_profile { display: flex; } diff --git a/src/components/views/room_settings/RoomProfileSettings.js b/src/components/views/room_settings/RoomProfileSettings.js index ccbe8e288a..9d96e6da35 100644 --- a/src/components/views/room_settings/RoomProfileSettings.js +++ b/src/components/views/room_settings/RoomProfileSettings.js @@ -200,7 +200,7 @@ export default class RoomProfileSettings extends React.Component { -
From fa99c2e8c5a4d90385b3b6377169dfb38e972a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 22 Dec 2020 13:14:55 +0100 Subject: [PATCH 4/8] Hide add button when new item field is empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/elements/EditableItemList.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/views/elements/EditableItemList.js b/src/components/views/elements/EditableItemList.js index 34e53906a2..3537d8fad0 100644 --- a/src/components/views/elements/EditableItemList.js +++ b/src/components/views/elements/EditableItemList.js @@ -118,15 +118,23 @@ export default class EditableItemList extends React.Component { }; _renderNewItemField() { + let addButton; + console.log(this.props.newItem); + if (this.props.newItem) { + addButton = ( + + {_t("Add")} + + ); + } + return (
- - {_t("Add")} - + { addButton } ); } From a7ca1d0856cc438190a08f4eb55797c37af7c383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 22 Dec 2020 13:26:53 +0100 Subject: [PATCH 5/8] Remove unnecessary line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/room_settings/RoomProfileSettings.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/room_settings/RoomProfileSettings.js b/src/components/views/room_settings/RoomProfileSettings.js index 9d96e6da35..6904351cad 100644 --- a/src/components/views/room_settings/RoomProfileSettings.js +++ b/src/components/views/room_settings/RoomProfileSettings.js @@ -62,7 +62,6 @@ export default class RoomProfileSettings extends React.Component { } _uploadAvatar = () => { - if (!this.state.canSetAvatar) return; this._avatarUpload.current.click(); }; From 7912091bc5914518ec201710ef2a4beacd1e05c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 29 Dec 2020 16:08:54 +0100 Subject: [PATCH 6/8] Revert "Hide add button when new item field is empty" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fa99c2e8c5a4d90385b3b6377169dfb38e972a63. Signed-off-by: Šimon Brandner --- src/components/views/elements/EditableItemList.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/components/views/elements/EditableItemList.js b/src/components/views/elements/EditableItemList.js index 3537d8fad0..34e53906a2 100644 --- a/src/components/views/elements/EditableItemList.js +++ b/src/components/views/elements/EditableItemList.js @@ -118,23 +118,15 @@ export default class EditableItemList extends React.Component { }; _renderNewItemField() { - let addButton; - console.log(this.props.newItem); - if (this.props.newItem) { - addButton = ( - - {_t("Add")} - - ); - } - return (
- { addButton } + + {_t("Add")} + ); } From 0083cf56bf3970ca44a8d66f9c90fe89102a45a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 29 Dec 2020 16:20:43 +0100 Subject: [PATCH 7/8] Hide buttons only if perrmissions are missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/room_settings/RoomProfileSettings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/room_settings/RoomProfileSettings.js b/src/components/views/room_settings/RoomProfileSettings.js index 6904351cad..c76c0823e4 100644 --- a/src/components/views/room_settings/RoomProfileSettings.js +++ b/src/components/views/room_settings/RoomProfileSettings.js @@ -164,7 +164,7 @@ export default class RoomProfileSettings extends React.Component { const AvatarSetting = sdk.getComponent('settings.AvatarSetting'); let profileSettingsButtons; - if (this.state.enableProfileSave) { + if (this.state.canSetTopic && this.state.canSetName) { profileSettingsButtons = (
Date: Tue, 29 Dec 2020 16:30:20 +0100 Subject: [PATCH 8/8] Disable add button if the field is empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/elements/EditableItemList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/elements/EditableItemList.js b/src/components/views/elements/EditableItemList.js index 34e53906a2..5a07a400d7 100644 --- a/src/components/views/elements/EditableItemList.js +++ b/src/components/views/elements/EditableItemList.js @@ -124,7 +124,7 @@ export default class EditableItemList extends React.Component { - + {_t("Add")}