Skip to content

Commit

Permalink
fix(Chat): include shared objects in unread count
Browse files Browse the repository at this point in the history
Signed-off-by: Sanskar Soni <[email protected]>
  • Loading branch information
sanskar-soni-9 committed Sep 5, 2024
1 parent 20f4bff commit 813026d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Chat/ChatManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ public function getUnreadCount(Room $chat, int $lastReadMessage): int {
$key = $chat->getId() . '-' . $lastReadMessage;
$unreadCount = $this->unreadCountCache->get($key);
if ($unreadCount === null) {
$unreadCount = $this->commentsManager->getNumberOfCommentsWithVerbsForObjectSinceComment('chat', (string)$chat->getId(), $lastReadMessage, [self::VERB_MESSAGE, 'object_shared']);
$unreadCount = $this->commentsManager->getNumberOfCommentsWithVerbsForObjectSinceComment('chat', (string)$chat->getId(), $lastReadMessage, [self::VERB_MESSAGE, self::VERB_OBJECT_SHARED]);
$this->unreadCountCache->set($key, $unreadCount, 1800);
}
return $unreadCount;
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,8 @@ public function markUnread(): DataResponse {
$previousMessage = $this->chatManager->getPreviousMessageWithVerb(
$this->room,
(int)$message->getId(),
[ChatManager::VERB_MESSAGE],
$message->getVerb() === ChatManager::VERB_MESSAGE
[ChatManager::VERB_MESSAGE, ChatManager::VERB_OBJECT_SHARED],
$message->getVerb() === ChatManager::VERB_MESSAGE || $message->getVerb() === ChatManager::VERB_OBJECT_SHARED
);
$unreadId = (int)$previousMessage->getId();
} catch (NotFoundException $e) {
Expand Down

0 comments on commit 813026d

Please sign in to comment.