This commit is contained in:
2026-06-19 00:45:09 +02:00
parent b3e8085085
commit ac5b38d8c9
2 changed files with 27 additions and 3 deletions

View File

@@ -280,6 +280,18 @@
return Array.from(next); return Array.from(next);
}; };
const syncSelectionWithCheckedState = (collection, value, isChecked) => {
const next = new Set(collection);
if (isChecked) {
next.add(value);
} else {
next.delete(value);
}
return Array.from(next);
};
const buildPatch = (state) => ({ const buildPatch = (state) => ({
profile: state.draft.profile, profile: state.draft.profile,
desktop: { desktop: {
@@ -388,13 +400,21 @@
} }
if (target.dataset.appId) { if (target.dataset.appId) {
state.draft.apps.enabled_ids = toggleSelection(state.draft.apps.enabled_ids, target.dataset.appId); state.draft.apps.enabled_ids = syncSelectionWithCheckedState(
state.draft.apps.enabled_ids,
target.dataset.appId,
target.checked
);
renderApp(root, state); renderApp(root, state);
return; return;
} }
if (target.dataset.widgetId) { if (target.dataset.widgetId) {
state.draft.widgets.active_ids = toggleSelection(state.draft.widgets.active_ids, target.dataset.widgetId); state.draft.widgets.active_ids = syncSelectionWithCheckedState(
state.draft.widgets.active_ids,
target.dataset.widgetId,
target.checked
);
renderApp(root, state); renderApp(root, state);
} }
}); });

View File

@@ -314,6 +314,10 @@ final class UserSelfManagementService
{ {
$trimmed = trim($value); $trimmed = trim($value);
return mb_substr($trimmed, 0, $maxLength); if (function_exists('mb_substr')) {
return mb_substr($trimmed, 0, $maxLength);
}
return substr($trimmed, 0, $maxLength);
} }
} }