diff --git a/ee/api/chalicelib/core/users.py b/ee/api/chalicelib/core/users.py index af6f51bda..b04f73c45 100644 --- a/ee/api/chalicelib/core/users.py +++ b/ee/api/chalicelib/core/users.py @@ -930,7 +930,8 @@ def get_user_settings(user_id): LIMIT 1""", {"user_id": user_id}) ) - return helper.dict_to_camel_case(cur.fetchone()) + settings = cur.fetchone() + return helper.dict_to_camel_case(settings) def update_user_module(user_id, data: schemas.ModuleStatus): diff --git a/ee/api/routers/core_dynamic.py b/ee/api/routers/core_dynamic.py index 000b5e160..56b8fb9ce 100644 --- a/ee/api/routers/core_dynamic.py +++ b/ee/api/routers/core_dynamic.py @@ -12,6 +12,7 @@ from chalicelib.core import sessions_viewed from chalicelib.core import tenants, users, projects, license from chalicelib.core import webhook from chalicelib.core.collaboration_slack import Slack +from chalicelib.core.users import get_user_settings from chalicelib.utils import SAML2_helper, smtp from chalicelib.utils import captcha from chalicelib.utils import helper @@ -119,6 +120,7 @@ def get_account(context: schemas.CurrentContext = Depends(OR_context)): **r, **t, **license.get_status(context.tenant_id), + "settings": get_user_settings(context.user_id)["settings"], "smtp": smtp.has_smtp(), "saml2": SAML2_helper.is_saml2_available() } diff --git a/frontend/app/components/Client/Modules/Modules.tsx b/frontend/app/components/Client/Modules/Modules.tsx index 146036e0d..5bd641bce 100644 --- a/frontend/app/components/Client/Modules/Modules.tsx +++ b/frontend/app/components/Client/Modules/Modules.tsx @@ -21,18 +21,18 @@ function Modules(props: Props) { try { const isEnabled = !module.isEnabled; module.isEnabled = isEnabled; - setModulesState([...modulesState]); + setModulesState((prevState) => [...prevState]); await userService.saveModules({ module: module.key, - status: isEnabled + status: isEnabled, }); - toast.success(`Module ${module.label} ${!isEnabled ? 'enabled' : 'disabled'}`); + toast.success(`Module ${module.label} ${isEnabled ? 'enabled' : 'disabled'}`); props.updateModule(module.key); } catch (err) { console.error(err); - toast.error(`Failed to ${module.isEnabled ? 'disable' : 'enable'} module ${module.label}`); + toast.error(`Failed to ${!module.isEnabled ? 'disable' : 'enable'} module ${module.label}`); module.isEnabled = !module.isEnabled; - setModulesState([...modulesState]); + setModulesState((prevState) => [...prevState]); } };