Fix stray 'account' heading (#12791)

* Fix stray 'account' heading

There's nothing in the 'account' section other than the password
change control now, so remove the whole section if you can't change
your password.

Fixes https://github.com/element-hq/element-web/issues/27756

* Unused import
pull/28217/head
David Baker 2024-07-18 14:04:40 +01:00 committed by GitHub
parent 924f5a079f
commit 564ea53b83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 18 deletions

View File

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { ReactNode } from "react";
import React from "react";
import { HTTPError } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
@ -146,22 +146,8 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
});
};
private renderAccountSection(): JSX.Element {
let passwordChangeSection: ReactNode = null;
if (this.state.canChangePassword) {
passwordChangeSection = (
<>
<SettingsSubsectionText>{_t("settings|general|password_change_section")}</SettingsSubsectionText>
<ChangePassword
className="mx_GeneralUserSettingsTab_section--account_changePassword"
rowClassName=""
buttonKind="primary"
onError={this.onPasswordChangeError}
onFinished={this.onPasswordChanged}
/>
</>
);
}
private renderAccountSection(): JSX.Element | undefined {
if (!this.state.canChangePassword) return undefined;
return (
<>
@ -170,7 +156,14 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
stretchContent
data-testid="accountSection"
>
{passwordChangeSection}
<SettingsSubsectionText>{_t("settings|general|password_change_section")}</SettingsSubsectionText>
<ChangePassword
className="mx_GeneralUserSettingsTab_section--account_changePassword"
rowClassName=""
buttonKind="primary"
onError={this.onPasswordChangeError}
onFinished={this.onPasswordChanged}
/>
</SettingsSubsection>
</>
);