Revert "fix(user-lifecycle-panel): restore filter-options population"
This reverts commit a1c6d62d44.
This commit is contained in:
@@ -3,12 +3,10 @@
|
||||
use MintyPHP\Module\Audit\Domain\UserLifecycleAction;
|
||||
use MintyPHP\Module\Audit\Domain\UserLifecycleStatus;
|
||||
use MintyPHP\Module\Audit\Domain\UserLifecycleTriggerType;
|
||||
use MintyPHP\Module\Audit\Service\UserLifecycleAuditService;
|
||||
|
||||
$canPurge = (bool) ($canUpdateSettings ?? false);
|
||||
|
||||
$filterSchema = require __DIR__ . '/../pages/audit/settings-user-lifecycle/filter-schema.php';
|
||||
$filterOptions = app(UserLifecycleAuditService::class)->filterOptions(200);
|
||||
$filterState = gridParseFilters(requestInput()->queryAll(), [
|
||||
...gridSchemaQuery($filterSchema),
|
||||
'actions' => [
|
||||
@@ -56,17 +54,6 @@ foreach (UserLifecycleAction::values() as $action) {
|
||||
'description' => $actionLabelMap[$action] ?? $action,
|
||||
];
|
||||
}
|
||||
// Defensive merge: catch DB values not covered by the PHP enum (migration drift).
|
||||
foreach ((array) ($filterOptions['actions'] ?? []) as $action) {
|
||||
$action = strtolower(trim((string) $action));
|
||||
if ($action === '' || isset($lifecycleActionItems[$action])) {
|
||||
continue;
|
||||
}
|
||||
$lifecycleActionItems[$action] = [
|
||||
'id' => $action,
|
||||
'description' => $actionLabelMap[$action] ?? $action,
|
||||
];
|
||||
}
|
||||
$lifecycleActionItems = array_values($lifecycleActionItems);
|
||||
|
||||
$lifecycleStatusItems = [];
|
||||
@@ -76,16 +63,6 @@ foreach (UserLifecycleStatus::values() as $status) {
|
||||
'description' => $statusLabelMap[$status] ?? $status,
|
||||
];
|
||||
}
|
||||
foreach ((array) ($filterOptions['statuses'] ?? []) as $status) {
|
||||
$status = strtolower(trim((string) $status));
|
||||
if ($status === '' || isset($lifecycleStatusItems[$status])) {
|
||||
continue;
|
||||
}
|
||||
$lifecycleStatusItems[$status] = [
|
||||
'id' => $status,
|
||||
'description' => $statusLabelMap[$status] ?? $status,
|
||||
];
|
||||
}
|
||||
$lifecycleStatusItems = array_values($lifecycleStatusItems);
|
||||
|
||||
$lifecycleTriggerItems = [];
|
||||
@@ -95,47 +72,14 @@ foreach (UserLifecycleTriggerType::values() as $triggerType) {
|
||||
'description' => $triggerLabelMap[$triggerType] ?? $triggerType,
|
||||
];
|
||||
}
|
||||
foreach ((array) ($filterOptions['trigger_types'] ?? []) as $triggerType) {
|
||||
$triggerType = strtolower(trim((string) $triggerType));
|
||||
if ($triggerType === '' || isset($lifecycleTriggerItems[$triggerType])) {
|
||||
continue;
|
||||
}
|
||||
$lifecycleTriggerItems[$triggerType] = [
|
||||
'id' => $triggerType,
|
||||
'description' => $triggerLabelMap[$triggerType] ?? $triggerType,
|
||||
];
|
||||
}
|
||||
$lifecycleTriggerItems = array_values($lifecycleTriggerItems);
|
||||
|
||||
$lifecycleActorItems = [];
|
||||
foreach ((array) ($filterOptions['actors'] ?? []) as $actorOption) {
|
||||
if (!is_array($actorOption)) {
|
||||
continue;
|
||||
}
|
||||
$actorId = (int) ($actorOption['id'] ?? 0);
|
||||
if ($actorId <= 0) {
|
||||
continue;
|
||||
}
|
||||
$actorDisplayName = trim((string) ($actorOption['display_name'] ?? ''));
|
||||
$actorEmail = trim((string) ($actorOption['email'] ?? ''));
|
||||
$actorExists = (bool) ($actorOption['exists'] ?? false);
|
||||
$label = $actorDisplayName !== '' ? $actorDisplayName : $actorEmail;
|
||||
if ($label === '') {
|
||||
$label = $actorExists
|
||||
? sprintf(t('User #%d'), $actorId)
|
||||
: sprintf(t('User #%d (deleted)'), $actorId);
|
||||
}
|
||||
$id = (string) $actorId;
|
||||
$lifecycleActorItems[$id] = [
|
||||
'id' => $id,
|
||||
'description' => $label,
|
||||
];
|
||||
}
|
||||
foreach ($activeActorUserIds as $actorId) {
|
||||
if (!isset($lifecycleActorItems[$actorId])) {
|
||||
$lifecycleActorItems[$actorId] = [
|
||||
'id' => $actorId,
|
||||
'description' => sprintf(t('User #%d (deleted)'), (int) $actorId),
|
||||
'description' => sprintf(t('User #%d'), (int) $actorId),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user