зеркало из https://github.com/nextcloud/spreed.git
Save the "count unread messages" query, when the last read is the last room messages
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
20737ff49e
Коммит
b3394e6235
|
@ -498,7 +498,13 @@ class RoomController extends AEnvironmentAwareController {
|
|||
$lastReadMessage = $this->chatManager->getLastReadMessageFromLegacy($room, $currentUser);
|
||||
$currentParticipant->setLastReadMessage($lastReadMessage);
|
||||
}
|
||||
$roomData['unreadMessages'] = $this->chatManager->getUnreadCount($room, $lastReadMessage);
|
||||
if ($room->getLastMessage() && $lastReadMessage === (int) $room->getLastMessage()->getId()) {
|
||||
// When the last message is the last read message, there are no unread messages,
|
||||
// so we can save the query.
|
||||
$roomData['unreadMessages'] = 0;
|
||||
} else {
|
||||
$roomData['unreadMessages'] = $this->chatManager->getUnreadCount($room, $lastReadMessage);
|
||||
}
|
||||
|
||||
$lastMention = $currentParticipant->getLastMentionMessage();
|
||||
$roomData['unreadMention'] = $lastMention !== 0 && $lastReadMessage < $lastMention;
|
||||
|
|
Загрузка…
Ссылка в новой задаче