diff --git a/src/lib/components/admin/Settings/Interface.svelte b/src/lib/components/admin/Settings/Interface.svelte index 0a4d0a6891..204415910c 100644 --- a/src/lib/components/admin/Settings/Interface.svelte +++ b/src/lib/components/admin/Settings/Interface.svelte @@ -10,9 +10,16 @@ import Switch from '$lib/components/common/Switch.svelte'; import Textarea from '$lib/components/common/Textarea.svelte'; import Spinner from '$lib/components/common/Spinner.svelte'; + import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte'; + import InterfaceDefaultsModal from './Interface/InterfaceDefaultsModal.svelte'; import { resetAllUsersInterfaceSettings } from '$lib/apis/users'; + // Toggles for the admin-defaults modal and the "reset all users" confirm + // dialog rendered at the bottom of this panel. + let showInterfaceDefaultsModal = false; + let showResetConfirmDialog = false; + const dispatch = createEventDispatcher(); const i18n = getContext('i18n'); diff --git a/src/lib/components/admin/Settings/Interface/InterfaceDefaultsModal.svelte b/src/lib/components/admin/Settings/Interface/InterfaceDefaultsModal.svelte index cdefeac1bb..8c9f1dbf81 100644 --- a/src/lib/components/admin/Settings/Interface/InterfaceDefaultsModal.svelte +++ b/src/lib/components/admin/Settings/Interface/InterfaceDefaultsModal.svelte @@ -33,16 +33,15 @@ } }; - // Prepare settings for backend - normalize chatDirection and filter nulls + // Prepare settings for backend — strip nulls so absent keys fall through + // to the user's own setting via deep-merge on load. Do NOT lowercase + // chatDirection: the user-side store is typed 'LTR' | 'RTL' | 'auto' + // and the toggle/render logic in chat/Settings/Interface.svelte matches + // against the uppercase values. Lowercasing here made admin defaults + // silently render as "Auto" because neither 'ltr' nor 'rtl' matched. const prepareForBackend = (settings: any): object => { - const result = { ...settings }; - - if (result.chatDirection) { - result.chatDirection = result.chatDirection.toLowerCase(); - } - return Object.fromEntries( - Object.entries(result).filter(([_, v]) => v !== undefined && v !== null) + Object.entries({ ...settings }).filter(([_, v]) => v !== undefined && v !== null) ); }; @@ -89,12 +88,15 @@ {#if !loading} -
+ {:else}