v1.3.0
v1.3.0
This release lets notification types be grouped on the account notification preferences page, and keeps each type's configuration in a single definition object.
Added
- Added
App\Services\NotificationTypeDefinition, a readonly object holding a notification type's default state and its optional group.NotificationType::definition()returns it for each case, anddefaultEnabled()now reads from it. - Added
NotificationType::group(), returning the slug of the group a notification type belongs to, ornullwhen it stands on its own. - Added grouped rendering to
/account/notifications. Notification types that declare a group are listed together under a parent checkbox reflecting the state of its children: checked when all of them are enabled, unchecked when none are, and indeterminate in between. Toggling the parent enables or disables every notification in the group. - Group titles and descriptions are read from
pages.notifications.groups.{group}.titleandpages.notifications.groups.{group}.description.
Changed
- Each entry of the notification preferences page
notificationsprop now carries agroupvalue:null, or an object with the group'sslug,title, anddescription.
Dependencies
- Updated minor and patch versions of Composer and npm dependencies.
Upgrade Guide
- Rebuild frontend assets with
npm run buildor your normal frontend workflow. - If you added your own cases to
App\Enums\NotificationType, move each case from thedefaultEnabled()match into thedefinition()match and returnnew NotificationTypeDefinition(defaultEnabled: ...).defaultEnabled()no longer matches on cases itself, so a case left only there raises an unhandled match error. - To group notification types, pass
group: 'your_group'to theirNotificationTypeDefinitionand addpages.notifications.groups.your_group.titleand.descriptionto each locale'spages.php. Missing keys are rendered as the raw translation key. - If you customized
resources/js/pages/account/notifications/Notifications.vue, merge the grouped rendering, or at least the newgroupkey on theNotificationTypeinterface.