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

Commit 564ea53

Browse files
authored
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 element-hq/element-web#27756 * Unused import
1 parent 924f5a0 commit 564ea53

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

src/components/views/settings/tabs/user/GeneralUserSettingsTab.tsx

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
1616
limitations under the License.
1717
*/
1818

19-
import React, { ReactNode } from "react";
19+
import React from "react";
2020
import { HTTPError } from "matrix-js-sdk/src/matrix";
2121
import { logger } from "matrix-js-sdk/src/logger";
2222

@@ -146,22 +146,8 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
146146
});
147147
};
148148

149-
private renderAccountSection(): JSX.Element {
150-
let passwordChangeSection: ReactNode = null;
151-
if (this.state.canChangePassword) {
152-
passwordChangeSection = (
153-
<>
154-
<SettingsSubsectionText>{_t("settings|general|password_change_section")}</SettingsSubsectionText>
155-
<ChangePassword
156-
className="mx_GeneralUserSettingsTab_section--account_changePassword"
157-
rowClassName=""
158-
buttonKind="primary"
159-
onError={this.onPasswordChangeError}
160-
onFinished={this.onPasswordChanged}
161-
/>
162-
</>
163-
);
164-
}
149+
private renderAccountSection(): JSX.Element | undefined {
150+
if (!this.state.canChangePassword) return undefined;
165151

166152
return (
167153
<>
@@ -170,7 +156,14 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
170156
stretchContent
171157
data-testid="accountSection"
172158
>
173-
{passwordChangeSection}
159+
<SettingsSubsectionText>{_t("settings|general|password_change_section")}</SettingsSubsectionText>
160+
<ChangePassword
161+
className="mx_GeneralUserSettingsTab_section--account_changePassword"
162+
rowClassName=""
163+
buttonKind="primary"
164+
onError={this.onPasswordChangeError}
165+
onFinished={this.onPasswordChanged}
166+
/>
174167
</SettingsSubsection>
175168
</>
176169
);

0 commit comments

Comments
 (0)