Skip to content

Commit

Permalink
- fix double notifications (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
EwelinaSkrzypacz authored Dec 5, 2024
1 parent 5dae013 commit a6960ea
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 a6960ea

Please sign in to comment.