fix: eliminate $_SESSION drift in SessionProvider and add notification UI states
Pass AppContainer to SessionProvider::clear() so all module providers use SessionStoreInterface consistently instead of raw $_SESSION. Also add loading and error states to the notification bell dropdown (GR-UI-014). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,15 +15,23 @@ final class AddressBookSessionProvider implements SessionProvider
|
||||
{
|
||||
public function populate(array $user, AppContainer $container): void
|
||||
{
|
||||
$userId = (int) ($user['id'] ?? 0);
|
||||
if ($userId <= 0) {
|
||||
unset($_SESSION['module.addressbook.departments_by_tenant']);
|
||||
$sessionStore = $container->get(SessionStoreInterface::class);
|
||||
if (!$sessionStore instanceof SessionStoreInterface) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tenantContext = $container->get(UserTenantContextService::class);
|
||||
$sessionStore = $container->get(SessionStoreInterface::class);
|
||||
if (!$tenantContext instanceof UserTenantContextService || !$sessionStore instanceof SessionStoreInterface) {
|
||||
$userId = (int) ($user['id'] ?? 0);
|
||||
if ($userId <= 0) {
|
||||
$sessionStore->remove('module.addressbook.departments_by_tenant');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$tenantContext = $container->get(UserTenantContextService::class);
|
||||
} catch (\Throwable) {
|
||||
return;
|
||||
}
|
||||
if (!$tenantContext instanceof UserTenantContextService) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,8 +41,11 @@ final class AddressBookSessionProvider implements SessionProvider
|
||||
);
|
||||
}
|
||||
|
||||
public function clear(): void
|
||||
public function clear(AppContainer $container): void
|
||||
{
|
||||
unset($_SESSION['module.addressbook.departments_by_tenant']);
|
||||
$sessionStore = $container->get(SessionStoreInterface::class);
|
||||
if ($sessionStore instanceof SessionStoreInterface) {
|
||||
$sessionStore->remove('module.addressbook.departments_by_tenant');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user