mirror of
https://github.com/nextcloud/spreed.git
synced 2025-07-21 05:46:02 +00:00
Merge pull request #15545 from nextcloud/bugfix/noid/empty-chat-for-guests
fix(chat): Fix guests in a fully empty chat
This commit is contained in:
@ -811,9 +811,14 @@ class ChatController extends AEnvironmentAwareOCSController {
|
||||
}
|
||||
|
||||
$currentUser = $this->userManager->get($this->userId);
|
||||
$commentsHistory = $this->chatManager->getHistory($this->room, $messageId, $limit, true, $threadId);
|
||||
$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, $threadId);
|
||||
$commentsHistory = array_reverse($commentsHistory);
|
||||
$commentsFuture = $this->chatManager->waitForNewMessages($this->room, $messageId, $limit, 0, $currentUser, false);
|
||||
}
|
||||
|
||||
return $this->prepareCommentsAsDataResponse(array_merge($commentsHistory, $commentsFuture));
|
||||
}
|
||||
|
@ -418,6 +418,11 @@ class RoomFormatter {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user