Skip to content

Commit

Permalink
Send notifications to observers
Browse files Browse the repository at this point in the history
  • Loading branch information
marien-probesys committed Aug 13, 2024
1 parent 7ec5234 commit 1cac918
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/MessageHandler/SendMessageEmailHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function __invoke(SendMessageEmail $data): void

$author = $message->getCreatedBy();
$requester = $ticket->getRequester();
$observers = $ticket->getObservers();
$assignee = $ticket->getAssignee();

$recipients = [];
Expand All @@ -58,6 +59,12 @@ public function __invoke(SendMessageEmail $data): void
$recipients[] = $requester->getEmail();
}

foreach ($observers as $observer) {
if ($observer !== $author) {
$recipients[] = $observer->getEmail();
}
}

if ($assignee && $assignee !== $author) {
$recipients[] = $assignee->getEmail();
}
Expand Down

0 comments on commit 1cac918

Please sign in to comment.