Skip to content
Corex

NotificationStatus

Corex\Notifications\NotificationStatus · class · Core layer

The per-user status of a notification. Derived from the shared record plus the user’s state row: dismissed (the user hid it) is deliberately distinct from resolved (the condition ended), so one user dismissing a shared, condition-based notification never resolves it for everyone (spec 072 FR-010).

derive(?string $resolvedAt, ?string $expiresAt, array $userState, DateTimeImmutable $now): string

Section titled “derive(?string $resolvedAt, ?string $expiresAt, array $userState, DateTimeImmutable $now): string”

Derive the status this actor sees, from the shared record plus their own state row. Precedence, highest first — the collisions are the whole point, so they are fixed here rather than left to each caller: 1. resolved — the condition ended. That is a fact about the record and outranks anything one user did to their copy (FR-010). 2. expired — the record aged out on its own terms. 3. dismissed— the user hid it, which supersedes their earlier read/snooze. 4. snoozed — only while snoozed_until is still in the future; an elapsed snooze is not a status, the item is simply back. 5. read / unread.