Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-07-24 16:31:19 +0300
committerJoas Schilling <coding@schilljs.com>2019-07-24 16:31:19 +0300
commite935f1978fef52fe7735edf62ba80c63a47b4fc6 (patch)
treefc5371e7e18e2bb1dc5c27abfa596e97ff1e600d /lib/Controller
parentc3d90782bc8b1c693dca8a6db8ac84ddb1968e79 (diff)
Make the read-marker update optional
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/ChatController.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index 15249f4f2..155b0528f 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -213,6 +213,8 @@ class ChatController extends AEnvironmentAwareController {
* @param int $limit Number of chat messages to receive (100 by default, 200 at most)
* @param int $lastKnownMessageId The last known message (serves as offset)
* @param int $timeout Number of seconds to wait for new messages (30 by default, 30 at most)
+ * @param int $setReadMarker Automatically set the last read marker when 1,
+ * if your client does this itself via chat/{token}/read set to 0
* @return DataResponse an array of chat messages, "404 Not found" if the
* room token was not valid or "304 Not modified" if there were no messages;
* each chat message is an array with
@@ -220,7 +222,7 @@ class ChatController extends AEnvironmentAwareController {
* 'actorDisplayName', 'timestamp' (in seconds and UTC timezone) and
* 'message'.
*/
- public function receiveMessages(int $lookIntoFuture, int $limit = 100, int $lastKnownMessageId = 0, int $timeout = 30): DataResponse {
+ public function receiveMessages(int $lookIntoFuture, int $limit = 100, int $lastKnownMessageId = 0, int $timeout = 30, int $setReadMarker = 1): DataResponse {
$limit = min(200, $limit);
$timeout = min(30, $timeout);
@@ -267,7 +269,9 @@ class ChatController extends AEnvironmentAwareController {
$newLastKnown = end($comments);
if ($newLastKnown instanceof IComment) {
$response->addHeader('X-Chat-Last-Given', $newLastKnown->getId());
- $this->participant->setLastReadMessage((int) $newLastKnown->getId());
+ if ($setReadMarker === 1) {
+ $this->participant->setLastReadMessage((int) $newLastKnown->getId());
+ }
}
return $response;