- Fix togglePermission() to always include all permission keys with false defaults - Add migration to backfill null/empty Manager permissions with config defaults - Rename nudge UI text from "Relance" to "Notification"/"Notifier" across 8 files - Fix select-all checkbox and show checkboxes on all declaration rows - Remove en_attente_client status restriction from BulkNotificationController Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
86 lines
6.1 KiB
Markdown
86 lines
6.1 KiB
Markdown
---
|
|
title: 'Fix permission persistence, nudge terminology, and bulk action bugs'
|
|
type: 'bugfix'
|
|
created: '2026-03-27'
|
|
status: 'done'
|
|
baseline_commit: 'bc100491f186edfac2e0581405006bb1df66b13a'
|
|
context: []
|
|
---
|
|
|
|
# Fix permission persistence, nudge terminology, and bulk action bugs
|
|
|
|
<frozen-after-approval reason="human-owned intent — do not modify unless human renegotiates">
|
|
|
|
## Intent
|
|
|
|
**Problem:** Three groups of bugs found during manual testing of Epics 1-3: (1) Manager permission toggles silently fail when `permissions` is null/empty because the payload omits required keys, (2) the nudge system incorrectly uses "Relance" which in this domain refers to client document requests, not manager-to-worker notifications, (3) bulk action checkboxes and select-all on the declarations page are broken and restricted to `en_attente_client` status only.
|
|
|
|
**Approach:** Fix the frontend permission payload to always include all keys with false defaults, add a data migration for existing null/empty rows, rename all nudge-context "Relance" to "Notification"/"Notifier", and remove the `en_attente_client` restriction from both the frontend checkbox rendering and backend query filter.
|
|
|
|
## Boundaries & Constraints
|
|
|
|
**Always:** Preserve "Relance" terminology where it refers to client document requests (Story 3.4 bulk notifications). All permission keys from `availablePermissions` must be sent in every toggle request.
|
|
|
|
**Ask First:** Any changes to the DeclarationInvitation creation logic or email templates beyond what's specified.
|
|
|
|
**Never:** Rename "Relance" in the bulk client notification system. Change permission validation rules in UpdatePermissionsRequest. Alter the nudge throttling logic.
|
|
|
|
## I/O & Edge-Case Matrix
|
|
|
|
| Scenario | Input / State | Expected Output / Behavior | Error Handling |
|
|
|----------|--------------|---------------------------|----------------|
|
|
| Toggle permission with null DB | Manager has `permissions: null` | All 3 keys sent, toggle persists | N/A |
|
|
| Toggle permission with partial DB | Manager has only `can_manage_team: true` | Missing keys default to false, all 3 sent | N/A |
|
|
| Select-all on mixed statuses | Page has draft, processing, en_attente_client rows | All rows selected | N/A |
|
|
| Bulk notify non-en_attente_client | Select a `draft` declaration and notify | Invitation created, email queued | N/A |
|
|
| Bulk notify declaration without client | Declaration has no client | Filtered out, not sent | Warning if all filtered |
|
|
|
|
</frozen-after-approval>
|
|
|
|
## Code Map
|
|
|
|
- `resources/js/pages/team/Index.vue` -- togglePermission() builds payload from availablePermissions base
|
|
- `database/migrations/2026_03_27_000001_backfill_manager_permissions.php` -- backfills null/empty manager permissions
|
|
- `app/Http/Controllers/NudgeController.php` -- flash messages use "Notification" instead of "Relance"
|
|
- `app/Mail/NudgeNotificationMail.php` -- email subject uses "Notification"
|
|
- `app/Enums/NotificationType.php` -- nudge label changed to "Notification"
|
|
- `resources/views/emails/nudge-notification.blade.php` -- email body uses "Notification"
|
|
- `resources/js/components/declarations/NudgePopover.vue` -- button/text uses "notification"
|
|
- `resources/js/pages/Dashboard.vue` -- dropdown item "Notifier" instead of "Relancer"
|
|
- `resources/js/components/NotificationDropdown.vue` -- nudge description uses "Notification"
|
|
- `resources/js/pages/notifications/Index.vue` -- nudge description uses "Notification"
|
|
- `resources/js/pages/declarations/Index.vue` -- checkboxes on all rows, select-all targets all visible
|
|
- `app/Http/Controllers/BulkNotificationController.php` -- removed en_attente_client status filter
|
|
|
|
## Tasks & Acceptance
|
|
|
|
**Execution:**
|
|
- [x] `resources/js/pages/team/Index.vue` -- Build base object from availablePermissions keys with false defaults before spreading member permissions
|
|
- [x] `database/migrations/2026_03_27_000001_backfill_manager_permissions.php` -- Create migration to update manager rows with null/empty permissions to config defaults
|
|
- [x] `app/Http/Controllers/NudgeController.php` -- Replace "Relance" with "Notification" in flash messages
|
|
- [x] `app/Mail/NudgeNotificationMail.php` -- Replace "Relance" with "Notification" in email subject
|
|
- [x] `app/Enums/NotificationType.php` -- Change nudge label from "Relance" to "Notification"
|
|
- [x] `resources/views/emails/nudge-notification.blade.php` -- Replace "Relance"/"relance" with "Notification"/"notification"
|
|
- [x] `resources/js/components/declarations/NudgePopover.vue` -- Replace "relance" with "notification" in button text
|
|
- [x] `resources/js/pages/Dashboard.vue` -- Replace "Relancer" with "Notifier" in dropdown
|
|
- [x] `resources/js/components/NotificationDropdown.vue` -- Replace "Relance" with "Notification" in nudge descriptions
|
|
- [x] `resources/js/pages/notifications/Index.vue` -- Replace "Relance" with "Notification" in nudge descriptions
|
|
- [x] `resources/js/pages/declarations/Index.vue` -- Remove eligibleDeclarations filter, show checkboxes on all rows, fix select-all to target all visible rows
|
|
- [x] `app/Http/Controllers/BulkNotificationController.php` -- Remove `->where('status', DeclarationStatus::EnAttenteClient)` filter
|
|
|
|
**Acceptance Criteria:**
|
|
- Given a Manager with null permissions in DB, when an Owner toggles a permission, then the toggle persists after page reload
|
|
- Given the declarations page with mixed-status rows, when clicking the header checkbox, then all visible rows are selected
|
|
- Given 1+ rows selected (any status), when clicking "Notifier les clients", then the BulkActionBar appears and notifications are sent
|
|
- Given a nudge is sent, when viewing the notification or email, then "Notification" appears instead of "Relance"
|
|
- Given a bulk client notification is sent (Story 3.4), then "Relance" terminology is preserved (not renamed)
|
|
|
|
## Verification
|
|
|
|
**Manual checks (if no CLI):**
|
|
- Toggle a Manager permission, navigate away, return — toggle state persists
|
|
- On declarations page, click header checkbox — all rows selected regardless of status
|
|
- Select rows, verify BulkActionBar appears with "Notifier les clients" button
|
|
- Send a nudge, check notification dropdown shows "Notification de X sur Y"
|
|
- Verify bulk client notification UI still shows correct terminology
|