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
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-08-28 18:58:22 +0300
committerJoas Schilling <coding@schilljs.com>2019-08-28 18:58:22 +0300
commit68bb3b7a422b82cb5b29fbf6bcaa08c168a2c221 (patch)
treeaf5bfb95511de1a62390a7c417e4873b6391a88d /lib
parentc428fdfda70c32a347fdee59d353c1666afbf599 (diff)
Set the automatic read marker before the waiting request, not afterwards
This false set the read marker on new messages although you navigated away to a different chat already. So we removed this and instead update the read marker before your next waiting. So when you are still there, it will just have a wrong read marker for the time until your next request starts, while it will not update the value, when you actually left the chat already. Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/ChatController.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index 4a38d0277..e06ce69eb 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -245,6 +245,22 @@ class ChatController extends AEnvironmentAwareController {
$this->room->ping($this->participant->getUser(), $this->participant->getSessionId(), $this->timeFactory->getTime());
}
+ /**
+ * Automatic last read message marking for old clients
+ * This is pretty dumb and does not give the best and native feeling
+ * you are used to from other chat apps. The clients should manually
+ * set the read marker depending on the view port of the set of messages.
+ *
+ * We are only setting it automatically here for old clients and the
+ * web UI, until it can be fixed in Vue. To not use too much broken data,
+ * we only update the read marker to the last known id, when it is higher
+ * then the current read marker.
+ */
+ if ($lookIntoFuture && $setReadMarker === 1 &&
+ $lastKnownMessageId > $this->participant->getLastReadMessage()) {
+ $this->participant->setLastReadMessage($lastKnownMessageId);
+ }
+
$currentUser = $this->userManager->get($this->userId);
if ($lookIntoFuture) {
$comments = $this->chatManager->waitForNewMessages($this->room, $lastKnownMessageId, $limit, $timeout, $currentUser);
@@ -332,9 +348,17 @@ class ChatController extends AEnvironmentAwareController {
$newLastKnown = end($comments);
if ($newLastKnown instanceof IComment) {
$response->addHeader('X-Chat-Last-Given', $newLastKnown->getId());
+ /**
+ * This false set the read marker on new messages although you
+ * navigated away to a different chat already. So we removed this
+ * and instead update the read marker before your next waiting.
+ * So when you are still there, it will just have a wrong read
+ * marker for the time until your next request starts, while it will
+ * not update the value, when you actually left the chat already.
if ($setReadMarker === 1 && $lookIntoFuture) {
$this->participant->setLastReadMessage((int) $newLastKnown->getId());
}
+ */
}
return $response;