From a54ac4700d254649f34fa7f50e3e4e0f89b0e0c7 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Tue, 8 Apr 2025 11:55:08 +0530 Subject: [PATCH] chore: Updating to logic to handle toggle changes when reverted manually should disable the save button on Admin settings (#40153) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Updating to logic to handle toggle changes when reverted manually should disable the save button on Admin settings Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Settings" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 3340b0658e9f57a89481cacf87727b79237e8afd > Cypress dashboard. > Tags: `@tag.Settings` > Spec: >
Tue, 08 Apr 2025 06:17:41 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **Refactor** - Enhanced the conditions for displaying certain admin settings, ensuring they now appear only when all required conditions are met. - Adjusted the update criteria for settings so that both checkbox and toggle types are better managed, preventing updates when appropriate. --- .../ce/pages/AdminSettings/config/authentication.tsx | 10 ++++++++-- app/client/src/pages/AdminSettings/SettingsForm.tsx | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/client/src/ce/pages/AdminSettings/config/authentication.tsx b/app/client/src/ce/pages/AdminSettings/config/authentication.tsx index c251df93c5..76cd28abcd 100644 --- a/app/client/src/ce/pages/AdminSettings/config/authentication.tsx +++ b/app/client/src/ce/pages/AdminSettings/config/authentication.tsx @@ -121,7 +121,9 @@ export const FormAuth: AdminConfigType = { return false; } - return settings.emailVerificationEnabled && mailEnabled; + return ( + settings.emailVerificationEnabled && mailEnabled && !isMultiOrgEnabled + ); }, }, { @@ -137,7 +139,11 @@ export const FormAuth: AdminConfigType = { return false; } - if (!mailEnabled && settings.emailVerificationEnabled) { + if ( + !mailEnabled && + settings.emailVerificationEnabled && + !isMultiOrgEnabled + ) { return true; } diff --git a/app/client/src/pages/AdminSettings/SettingsForm.tsx b/app/client/src/pages/AdminSettings/SettingsForm.tsx index 386222b971..ac4c240c1f 100644 --- a/app/client/src/pages/AdminSettings/SettingsForm.tsx +++ b/app/client/src/pages/AdminSettings/SettingsForm.tsx @@ -395,7 +395,8 @@ export default withRouter( _.forEach(AdminConfig.settingsMap, (setting, name) => { const fieldValue = selector(state, name); const doNotUpdate = - setting.controlType === SettingTypes.CHECKBOX && + (setting.controlType === SettingTypes.CHECKBOX || + setting.controlType === SettingTypes.TOGGLE) && !settingsConfig[name] && !fieldValue;