Allow saving room topic or name only

This changes the room profile settings to support saving _only_ the room topic or
name in case you have limited access to set one but not the other.

Fixes https://github.com/vector-im/element-web/issues/16375
This commit is contained in:
J. Ryan Stinnett 2021-02-05 13:34:06 +00:00
parent 15a4032be0
commit bffce8689a

View File

@ -81,7 +81,11 @@ export default class RoomProfileSettings extends React.Component {
if (!this.state.enableProfileSave) return; if (!this.state.enableProfileSave) return;
this._removeAvatar(); this._removeAvatar();
this.setState({enableProfileSave: false, displayName: this.state.originalDisplayName}); this.setState({
enableProfileSave: false,
displayName: this.state.originalDisplayName,
topic: this.state.originalTopic,
});
}; };
_saveProfile = async (e) => { _saveProfile = async (e) => {
@ -164,7 +168,7 @@ export default class RoomProfileSettings extends React.Component {
const AvatarSetting = sdk.getComponent('settings.AvatarSetting'); const AvatarSetting = sdk.getComponent('settings.AvatarSetting');
let profileSettingsButtons; let profileSettingsButtons;
if (this.state.canSetTopic && this.state.canSetName) { if (this.state.canSetTopic || this.state.canSetName) {
profileSettingsButtons = ( profileSettingsButtons = (
<div className="mx_ProfileSettings_buttons"> <div className="mx_ProfileSettings_buttons">
<AccessibleButton <AccessibleButton