Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/Controller/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,14 @@ public function getMessageContext(
}

$currentUser = $this->userManager->get($this->userId);
$commentsHistory = $this->chatManager->getHistory($this->room, $messageId, $limit, true);
$commentsHistory = array_reverse($commentsHistory);
$commentsFuture = $this->chatManager->waitForNewMessages($this->room, $messageId, $limit, 0, $currentUser, false);
if ($messageId === 0) {
// Guest in a fully expired chat, no history, just loading the chat from beginning for now
$commentsHistory = $commentsFuture = [];
} else {
$commentsHistory = $this->chatManager->getHistory($this->room, $messageId, $limit, true);
$commentsHistory = array_reverse($commentsHistory);
$commentsFuture = $this->chatManager->waitForNewMessages($this->room, $messageId, $limit, 0, $currentUser, false);
}

return $this->prepareCommentsAsDataResponse(array_merge($commentsHistory, $commentsFuture));
}
Expand Down
5 changes: 5 additions & 0 deletions lib/Service/RoomFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,11 @@ public function formatRoomV4(
}
}

if ($roomData['lastReadMessage'] === 0) {
// Guest in a fully expired chat, no history, just loading the chat from beginning for now
$roomData['lastReadMessage'] = ChatManager::UNREAD_FIRST_MESSAGE;
}

if ($currentUser instanceof IUser
&& $attendee->getActorType() === Attendee::ACTOR_USERS
&& $roomData['lastReadMessage'] === ChatManager::UNREAD_FIRST_MESSAGE
Expand Down
Loading