summaryrefslogtreecommitdiffstats
path: root/lib/Controller
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-03-19 14:49:34 +0100
committerJoas Schilling <coding@schilljs.com>2024-03-19 14:49:34 +0100
commit5f8c5e8e45cebd538261cd7d37ba8eac84320551 (patch)
treea5633ad3fbeb184c6ca3cd62d3efbeba9cc7616d /lib/Controller
parentba4ff4ff1561f0b459cc4b71094e86c5a9fa0cbd (diff)
fix(chat): Mark notifications read when setting the readmarker to the end
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/ChatController.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index 13e40592b..896a45031 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -30,6 +30,7 @@ use OCA\Talk\Chat\AutoComplete\SearchPlugin;
use OCA\Talk\Chat\AutoComplete\Sorter;
use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Chat\MessageParser;
+use OCA\Talk\Chat\Notifier;
use OCA\Talk\Chat\ReactionManager;
use OCA\Talk\Exceptions\CannotReachRemoteException;
use OCA\Talk\Federation\Authenticator;
@@ -130,6 +131,7 @@ class ChatController extends AEnvironmentAwareController {
private IL10N $l,
protected Authenticator $federationAuthenticator,
protected ProxyCacheMessageService $pcmService,
+ protected Notifier $notifier,
) {
parent::__construct($appName, $request);
}
@@ -1086,14 +1088,19 @@ class ChatController extends AEnvironmentAwareController {
#[PublicPage]
#[RequireAuthenticatedParticipant]
public function setReadMarker(?int $lastReadMessage = null): DataResponse {
+ $setToMessage = $lastReadMessage ?? $this->room->getLastMessageId();
+ if ($setToMessage === $this->room->getLastMessageId()
+ && $this->participant->getAttendee()->getActorType() === Attendee::ACTOR_USERS) {
+ $this->notifier->markMentionNotificationsRead($this->room, $this->participant->getAttendee()->getActorId());
+ }
+
if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController::class);
return $proxy->setReadMarker($this->room, $this->participant, $this->getResponseFormat(), $lastReadMessage);
}
- $lastReadMessage = $lastReadMessage ?? $this->room->getLastMessageId();
- $this->participantService->updateLastReadMessage($this->participant, $lastReadMessage);
+ $this->participantService->updateLastReadMessage($this->participant, $setToMessage);
$attendee = $this->participant->getAttendee();
$headers = $lastCommonRead = [];