fix: resolve permission toggle persistence, nudge terminology, and bulk action bugs (Bugs #2-5)
- 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>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Backfill Manager workspace_user rows that have null or empty permissions
|
||||
* with the defaults from config('permissions.defaults.manager').
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$defaults = json_encode(config('permissions.defaults.manager'));
|
||||
|
||||
DB::table('workspace_user')
|
||||
->where('role', 'manager')
|
||||
->where(function ($query) {
|
||||
$query->whereNull('permissions')
|
||||
->orWhere('permissions', '[]')
|
||||
->orWhere('permissions', 'null')
|
||||
->orWhere('permissions', '');
|
||||
})
|
||||
->update(['permissions' => $defaults]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migration (no-op — we cannot know original values).
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Cannot reverse: original null/empty values are indistinguishable
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user