check
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user