mirror of
https://github.com/nextcloud/spreed.git
synced 2025-07-22 12:01: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);
|
$currentUser = $this->userManager->get($this->userId);
|
||||||
$commentsHistory = $this->chatManager->getHistory($this->room, $messageId, $limit, true, $threadId);
|
if ($messageId === 0) {
|
||||||
$commentsHistory = array_reverse($commentsHistory);
|
// Guest in a fully expired chat, no history, just loading the chat from beginning for now
|
||||||
$commentsFuture = $this->chatManager->waitForNewMessages($this->room, $messageId, $limit, 0, $currentUser, false);
|
$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));
|
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
|
if ($currentUser instanceof IUser
|
||||||
&& $attendee->getActorType() === Attendee::ACTOR_USERS
|
&& $attendee->getActorType() === Attendee::ACTOR_USERS
|
||||||
&& $roomData['lastReadMessage'] === ChatManager::UNREAD_FIRST_MESSAGE
|
&& $roomData['lastReadMessage'] === ChatManager::UNREAD_FIRST_MESSAGE
|
||||||
|
Reference in New Issue
Block a user