diff options
author | Joas Schilling <coding@schilljs.com> | 2022-05-06 10:59:27 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-05-13 12:34:23 +0300 |
commit | 866201678f95301ef37d2a93ea05707edb0f6927 (patch) | |
tree | e1f7861a36e3d5338353365b11c66b9b32c39538 /lib/Chat/ChatManager.php | |
parent | 2742779a7621e13bb92a059eda34b4a433f739f9 (diff) |
Add an option for "Silent send" to the API
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Chat/ChatManager.php')
-rw-r--r-- | lib/Chat/ChatManager.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Chat/ChatManager.php b/lib/Chat/ChatManager.php index 398a5f6cf..b20021f75 100644 --- a/lib/Chat/ChatManager.php +++ b/lib/Chat/ChatManager.php @@ -179,7 +179,7 @@ class ChatManager { } if ($sendNotifications) { - $this->notifier->notifyOtherParticipant($chat, $comment, []); + $this->notifier->notifyOtherParticipant($chat, $comment, [], false); } $this->dispatcher->dispatch(self::EVENT_AFTER_SYSTEM_MESSAGE_SEND, $event); @@ -238,7 +238,7 @@ class ChatManager { * @param string $referenceId * @return IComment */ - public function sendMessage(Room $chat, Participant $participant, string $actorType, string $actorId, string $message, \DateTime $creationDateTime, ?IComment $replyTo, string $referenceId): IComment { + public function sendMessage(Room $chat, Participant $participant, string $actorType, string $actorId, string $message, \DateTime $creationDateTime, ?IComment $replyTo, string $referenceId, bool $silent): IComment { $comment = $this->commentsManager->create($actorType, $actorId, 'chat', (string) $chat->getId()); $comment->setMessage($message, self::MAX_CHAT_LENGTH); $comment->setCreationDateTime($creationDateTime); @@ -255,7 +255,7 @@ class ChatManager { $comment->setReferenceId($referenceId); } - $event = new ChatParticipantEvent($chat, $comment, $participant); + $event = new ChatParticipantEvent($chat, $comment, $participant, $silent); $this->dispatcher->dispatch(self::EVENT_BEFORE_MESSAGE_SEND, $event); $shouldFlush = $this->notificationManager->defer(); @@ -273,20 +273,20 @@ class ChatManager { $alreadyNotifiedUsers = []; $usersDirectlyMentioned = $this->notifier->getMentionedUserIds($comment); if ($replyTo instanceof IComment) { - $alreadyNotifiedUsers = $this->notifier->notifyReplyToAuthor($chat, $comment, $replyTo); + $alreadyNotifiedUsers = $this->notifier->notifyReplyToAuthor($chat, $comment, $replyTo, $silent); if ($replyTo->getActorType() === Attendee::ACTOR_USERS) { $usersDirectlyMentioned[] = $replyTo->getActorId(); } } - $alreadyNotifiedUsers = $this->notifier->notifyMentionedUsers($chat, $comment, $alreadyNotifiedUsers); + $alreadyNotifiedUsers = $this->notifier->notifyMentionedUsers($chat, $comment, $alreadyNotifiedUsers, $silent); if (!empty($alreadyNotifiedUsers)) { $userIds = array_column($alreadyNotifiedUsers, 'id'); $this->participantService->markUsersAsMentioned($chat, $userIds, (int) $comment->getId(), $usersDirectlyMentioned); } // User was not mentioned, send a normal notification - $this->notifier->notifyOtherParticipant($chat, $comment, $alreadyNotifiedUsers); + $this->notifier->notifyOtherParticipant($chat, $comment, $alreadyNotifiedUsers, $silent); $this->dispatcher->dispatch(self::EVENT_AFTER_MESSAGE_SEND, $event); } catch (NotFoundException $e) { |