Fixed 16014
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
c4f7269321
commit
15d10042ee
1 changed files with 36 additions and 24 deletions
|
@ -120,17 +120,21 @@ export default class RoomProfileSettings extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
_onDisplayNameChanged = (e) => {
|
_onDisplayNameChanged = (e) => {
|
||||||
this.setState({
|
this.setState({displayName: e.target.value});
|
||||||
displayName: e.target.value,
|
if (this.state.originalDisplayName === e.target.value) {
|
||||||
enableProfileSave: true,
|
this.setState({enableProfileSave: false});
|
||||||
});
|
} else {
|
||||||
|
this.setState({enableProfileSave: true});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_onTopicChanged = (e) => {
|
_onTopicChanged = (e) => {
|
||||||
this.setState({
|
this.setState({topic: e.target.value});
|
||||||
topic: e.target.value,
|
if (this.state.originalTopic === e.target.value) {
|
||||||
enableProfileSave: true,
|
this.setState({enableProfileSave: false});
|
||||||
});
|
} else {
|
||||||
|
this.setState({enableProfileSave: true});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_onAvatarChanged = (e) => {
|
_onAvatarChanged = (e) => {
|
||||||
|
@ -158,6 +162,29 @@ export default class RoomProfileSettings extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
|
||||||
const AvatarSetting = sdk.getComponent('settings.AvatarSetting');
|
const AvatarSetting = sdk.getComponent('settings.AvatarSetting');
|
||||||
|
|
||||||
|
let profileSettingsButtons;
|
||||||
|
if (this.state.enableProfileSave) {
|
||||||
|
profileSettingsButtons = (
|
||||||
|
<div className="mx_ProfileSettings_buttons">
|
||||||
|
<AccessibleButton
|
||||||
|
onClick={this._clearProfile}
|
||||||
|
kind="link"
|
||||||
|
disabled={!this.state.enableProfileSave}
|
||||||
|
>
|
||||||
|
{_t("Cancel")}
|
||||||
|
</AccessibleButton>
|
||||||
|
<AccessibleButton
|
||||||
|
onClick={this._saveProfile}
|
||||||
|
kind="primary"
|
||||||
|
disabled={!this.state.enableProfileSave}
|
||||||
|
>
|
||||||
|
{_t("Save")}
|
||||||
|
</AccessibleButton>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form
|
<form
|
||||||
onSubmit={this._saveProfile}
|
onSubmit={this._saveProfile}
|
||||||
|
@ -183,22 +210,7 @@ export default class RoomProfileSettings extends React.Component {
|
||||||
uploadAvatar={this.state.canSetAvatar ? this._uploadAvatar : undefined}
|
uploadAvatar={this.state.canSetAvatar ? this._uploadAvatar : undefined}
|
||||||
removeAvatar={this.state.canSetAvatar ? this._removeAvatar : undefined} />
|
removeAvatar={this.state.canSetAvatar ? this._removeAvatar : undefined} />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_ProfileSettings_buttons">
|
{ profileSettingsButtons }
|
||||||
<AccessibleButton
|
|
||||||
onClick={this._clearProfile}
|
|
||||||
kind="link"
|
|
||||||
disabled={!this.state.enableProfileSave}
|
|
||||||
>
|
|
||||||
{_t("Cancel")}
|
|
||||||
</AccessibleButton>
|
|
||||||
<AccessibleButton
|
|
||||||
onClick={this._saveProfile}
|
|
||||||
kind="primary"
|
|
||||||
disabled={!this.state.enableProfileSave}
|
|
||||||
>
|
|
||||||
{_t("Save")}
|
|
||||||
</AccessibleButton>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue