Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix stray 'account' heading (#12791)
Browse files Browse the repository at this point in the history
* 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 element-hq/element-web#27756

* Unused import
  • Loading branch information
dbkr authored Jul 18, 2024
1 parent 924f5a0 commit 564ea53
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions src/components/views/settings/tabs/user/GeneralUserSettingsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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 (
<>
Expand All @@ -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>
</>
);
Expand Down

0 comments on commit 564ea53

Please sign in to comment.