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/Controller/ChatController.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/Controller/ChatController.php')
-rw-r--r-- | lib/Controller/ChatController.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index 8e508d0b0..f0033649c 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -192,11 +192,12 @@ class ChatController extends AEnvironmentAwareController { * @param string $actorDisplayName for guests * @param string $referenceId for the message to be able to later identify it again * @param int $replyTo Parent id which this message is a reply to + * @param bool $silent If sent silent the chat message will not create any notifications * @return DataResponse the status code is "201 Created" if successful, and * "404 Not found" if the room or session for a guest user was not * found". */ - public function sendMessage(string $message, string $actorDisplayName = '', string $referenceId = '', int $replyTo = 0): DataResponse { + public function sendMessage(string $message, string $actorDisplayName = '', string $referenceId = '', int $replyTo = 0, bool $silent = false): DataResponse { [$actorType, $actorId] = $this->getActorInfo($actorDisplayName); if (!$actorId) { return new DataResponse([], Http::STATUS_NOT_FOUND); @@ -222,7 +223,7 @@ class ChatController extends AEnvironmentAwareController { $creationDateTime = $this->timeFactory->getDateTime('now', new \DateTimeZone('UTC')); try { - $comment = $this->chatManager->sendMessage($this->room, $this->participant, $actorType, $actorId, $message, $creationDateTime, $parent, $referenceId); + $comment = $this->chatManager->sendMessage($this->room, $this->participant, $actorType, $actorId, $message, $creationDateTime, $parent, $referenceId, $silent); } catch (MessageTooLongException $e) { return new DataResponse([], Http::STATUS_REQUEST_ENTITY_TOO_LARGE); } catch (\Exception $e) { |