Skip to content

Commit

Permalink
- fix double notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
EwelinaSkrzypacz committed Dec 4, 2024
1 parent 252b2aa commit 12d8026
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/Actions/VacationRequest/ApproveAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public function execute(VacationRequest $vacationRequest, ?User $user = null): v

protected function notify(VacationRequest $vacationRequest): void
{
$users = Permission::findByName("receiveVacationRequestStatusChangedNotification")->users()->get();
$users = Permission::findByName("receiveVacationRequestStatusChangedNotification")
->users()
->where("id", "!=", $vacationRequest->user->id)
->get();

foreach ($users as $user) {
$user->notify(new VacationRequestStatusChangedNotification($vacationRequest, $user));
Expand Down
5 changes: 4 additions & 1 deletion app/Actions/VacationRequest/CancelAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public function execute(VacationRequest $vacationRequest, User $user): void

protected function notify(VacationRequest $vacationRequest): void
{
$users = Permission::findByName("receiveVacationRequestStatusChangedNotification")->users()->get();
$users = Permission::findByName("receiveVacationRequestStatusChangedNotification")
->users()
->where("id", "!=", $vacationRequest->user->id)
->get();

foreach ($users as $user) {
$user->notify(new VacationRequestStatusChangedNotification($vacationRequest, $user));
Expand Down

0 comments on commit 12d8026

Please sign in to comment.