From 814e958e1184874b591ff037458fe57ddb8dea26 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Tue, 30 Jul 2024 14:20:51 +0200 Subject: [PATCH] disable save when all fields are readonly (#31535) fixes: #31304 Signed-off-by: Erik Jan de Wit --- .../src/personal-info/PersonalInfo.tsx | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/js/apps/account-ui/src/personal-info/PersonalInfo.tsx b/js/apps/account-ui/src/personal-info/PersonalInfo.tsx index 98ad25b0ac..3e7e5403ff 100644 --- a/js/apps/account-ui/src/personal-info/PersonalInfo.tsx +++ b/js/apps/account-ui/src/personal-info/PersonalInfo.tsx @@ -95,6 +95,11 @@ export const PersonalInfo = () => { return ; } + const allFieldsReadOnly = () => + userProfileMetadata?.attributes + ?.map((a) => a.readOnly) + .reduce((p, c) => p && c, true); + const { updateEmailFeatureEnabled, updateEmailActionEnabled, @@ -132,24 +137,26 @@ export const PersonalInfo = () => { ) : undefined } /> - - - - + {!allFieldsReadOnly() && ( + + + + + )} {context.environment.features.deleteAccountAllowed && (