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:
@@ -16,6 +16,8 @@ final class NotificationType extends Enum
|
||||
|
||||
const StatusChanged = 'status_changed';
|
||||
|
||||
const Mention = 'mention';
|
||||
|
||||
/**
|
||||
* Get French display labels for each notification type.
|
||||
*
|
||||
@@ -24,11 +26,12 @@ final class NotificationType extends Enum
|
||||
public static function labels(): array
|
||||
{
|
||||
return [
|
||||
self::Nudge => 'Relance',
|
||||
self::Nudge => 'Notification',
|
||||
self::DeclarationOverdue => 'Déclaration en retard',
|
||||
self::DocumentUploaded => 'Document téléversé',
|
||||
self::BulkNotification => 'Notification groupée',
|
||||
self::StatusChanged => 'Statut modifié',
|
||||
self::Mention => 'Mention',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Concerns\HasWorkspaceScope;
|
||||
use App\Enums\DeclarationStatus;
|
||||
use App\Http\Requests\BulkNotifyRequest;
|
||||
use App\Mail\DeclarationFileRequestMail;
|
||||
use App\Models\Declaration;
|
||||
@@ -24,7 +23,6 @@ class BulkNotificationController extends Controller
|
||||
|
||||
$declarations = Declaration::where('workspace_id', $workspace->id)
|
||||
->forUser($user, $workspaceUser)
|
||||
->where('status', DeclarationStatus::EnAttenteClient)
|
||||
->whereIn('id', $request->validated('declaration_ids'))
|
||||
->with('client')
|
||||
->get()
|
||||
|
||||
@@ -44,7 +44,7 @@ class NudgeController extends Controller
|
||||
->exists();
|
||||
|
||||
if ($recentNudge) {
|
||||
return back()->with('flash', ['type' => 'warning', 'message' => 'Relance déjà envoyée récemment']);
|
||||
return back()->with('flash', ['type' => 'warning', 'message' => 'Notification déjà envoyée récemment']);
|
||||
}
|
||||
|
||||
$assignee->notify(new NudgeNotification($declaration, $request->user()));
|
||||
@@ -56,6 +56,6 @@ class NudgeController extends Controller
|
||||
|
||||
Cache::forget("user:{$assignee->id}:workspace:{$workspace->id}:unread_notifications");
|
||||
|
||||
return back()->with('flash', ['type' => 'success', 'message' => 'Relance envoyée à '.$assignee->name]);
|
||||
return back()->with('flash', ['type' => 'success', 'message' => 'Notification envoyée à '.$assignee->name]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class NudgeNotificationMail extends Mailable
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Relance - '.($this->declaration->title ?? 'Sans titre'),
|
||||
subject: 'Notification - '.($this->declaration->title ?? 'Sans titre'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Enums\NotificationType;
|
||||
use App\Models\Declaration;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
@@ -33,6 +34,8 @@ class DeclarationMentionNotification extends Notification implements ShouldQueue
|
||||
public function toDatabase(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'workspace_id' => $this->declaration->workspace_id,
|
||||
'notification_type' => NotificationType::Mention,
|
||||
'declaration_id' => $this->declaration->id,
|
||||
'declaration_title' => $this->declaration->title,
|
||||
'mentioned_by_id' => $this->mentionedBy->id,
|
||||
|
||||
@@ -48,6 +48,7 @@ class NudgeNotification extends Notification implements ShouldQueue
|
||||
|
||||
public function toMail(object $notifiable): NudgeNotificationMail
|
||||
{
|
||||
return new NudgeNotificationMail($this->declaration, $this->sender);
|
||||
return (new NudgeNotificationMail($this->declaration, $this->sender))
|
||||
->to($notifiable->email);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user