Issue #3580209: [Notifications] notification storage and service
Closes #3580209 Builds on work in https://git.drupalcode.org/issue/canvas-3573776/-/tree/3573776-canvas-needs-a
- Adds canvas_notification and canvas_notification_read database tables via hook_schema() and canvas_update_10014()
- Implements CanvasNotificationHandler service with create(), getRecent(), markRead(), purgeStaleProcessing(), and deleteExpired() methods
- Registers the service in canvas.services.yml with autowire
- Adds kernel tests covering all public methods and edge cases
Notes:
-
getRecent()uses two separate queries via Drupal's query builder instead of a single UNION ALL raw SQL query. SQLite (used by kernel tests) does not support parenthesized sub-selects with ORDER BY/LIMIT inside UNION ALL. - Key-replacement in
create()targets only processing/error/warning types, not all notifications with the same key. The plan stated that success/info types "do NOT delete" when created with a key. The implementation instead deletes existing processing, error, and warning notifications with the same key for all notification types — including success and info. This correctly handles state transitions (e.g. processing -> success should clean up the processing notification). Existing success/info notifications are preserved. -
create()returns the notification array. The plan's method signature showed create(): array but the spec originally had it returning void. The return value is useful for tests and will be needed by the API controller in Ticket 2.
Edited by Sally Young