diff --git a/lib/Federation/CloudFederationProviderTalk.php b/lib/Federation/CloudFederationProviderTalk.php index 43552b3497d..2788300a01d 100644 --- a/lib/Federation/CloudFederationProviderTalk.php +++ b/lib/Federation/CloudFederationProviderTalk.php @@ -415,6 +415,10 @@ private function messagePosted(int $remoteAttendeeId, array $notification): arra return []; } + $this->logger->debug('Setting unread info for local federated user ' . $invite->getUserId() . ' in ' . $room->getToken() . ' to ' . json_encode($notification['unreadInfo']), [ + 'app' => 'spreed-federation', + ]); + $this->participantService->updateUnreadInfoForProxyParticipant( $participant, $notification['unreadInfo']['unreadMessages'], diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index afc431ed9bd..00018426ba2 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -460,6 +460,9 @@ private function assertRooms($rooms, TableNode $formData, bool $shouldOrder = fa if (isset($expectedRoom['lastMessage'])) { $data['lastMessage'] = $room['lastMessage'] ? $room['lastMessage']['message'] : ''; } + if (isset($expectedRoom['lastReadMessage'])) { + $data['lastReadMessage'] = self::$messageIdToText[(int) $room['lastReadMessage']] ?? (!$room['lastReadMessage'] ? 'ZERO': 'UNKNOWN_MESSAGE'); + } if (isset($expectedRoom['unreadMessages'])) { $data['unreadMessages'] = (int) $room['unreadMessages']; } diff --git a/tests/integration/features/federation/chat.feature b/tests/integration/features/federation/chat.feature index d600b7e0437..b56078ce27a 100644 --- a/tests/integration/features/federation/chat.feature +++ b/tests/integration/features/federation/chat.feature @@ -147,26 +147,26 @@ Feature: federation/chat | id | name | type | remoteServer | remoteToken | | room | room | 2 | LOCAL | room | Then user "participant2" is participant of the following rooms (v4) - | id | type | unreadMessages | unreadMention | unreadMentionDirect | - | room | 2 | 0 | 0 | 0 | + | id | type | lastReadMessage | unreadMessages | unreadMention | unreadMentionDirect | + | room | 2 | UNKNOWN_MESSAGE | 0 | 0 | 0 | And user "participant1" sends message "Message 1" to room "room" with 201 And user "participant1" sends message "Message 2" to room "room" with 201 When user "participant2" marks room "LOCAL::room" as unread with 200 (v1) Then user "participant2" is participant of the following rooms (v4) - | id | type | unreadMessages | unreadMention | unreadMentionDirect | - | room | 2 | 1 | 0 | 0 | + | id | type | lastReadMessage | unreadMessages | unreadMention | unreadMentionDirect | + | room | 2 | Message 1 | 1 | 0 | 0 | When user "participant2" reads message "NULL" in room "LOCAL::room" with 200 (v1) Then user "participant2" is participant of the following rooms (v4) - | id | type | unreadMessages | unreadMention | unreadMentionDirect | - | room | 2 | 0 | 0 | 0 | + | id | type | lastReadMessage | unreadMessages | unreadMention | unreadMentionDirect | + | room | 2 | Message 2 | 0 | 0 | 0 | When user "participant2" reads message "Message 1" in room "LOCAL::room" with 200 (v1) Then user "participant2" is participant of the following rooms (v4) - | id | type | unreadMessages | unreadMention | unreadMentionDirect | - | room | 2 | 1 | 0 | 0 | + | id | type | lastReadMessage | unreadMessages | unreadMention | unreadMentionDirect | + | room | 2 | Message 1 | 1 | 0 | 0 | When user "participant2" reads message "Message 2" in room "LOCAL::room" with 200 (v1) Then user "participant2" is participant of the following rooms (v4) - | id | type | unreadMessages | unreadMention | unreadMentionDirect | - | room | 2 | 0 | 0 | 0 | + | id | type | lastReadMessage | unreadMessages | unreadMention | unreadMentionDirect | + | room | 2 | Message 2 | 0 | 0 | 0 | Scenario: Error handling of chatting (posting a too long message) Given the following "spreed" app config is set