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
6 changes: 3 additions & 3 deletions lib/Federation/Proxy/TalkV1/Controller/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@ public function deleteMessage(Room $room, Participant $participant, int $message
*
* 200: List of mention suggestions returned
*/
public function setReadMarker(Room $room, Participant $participant, string $responseFormat, int $lastReadMessage): DataResponse {
public function setReadMarker(Room $room, Participant $participant, string $responseFormat, ?int $lastReadMessage): DataResponse {
$proxy = $this->proxy->post(
$participant->getAttendee()->getInvitedCloudId(),
$participant->getAttendee()->getAccessToken(),
$room->getRemoteServer() . '/ocs/v2.php/apps/spreed/api/v1/chat/' . $room->getRemoteToken() . '/read',
[
$lastReadMessage !== null ? [
'lastReadMessage' => $lastReadMessage,
],
] : [],
);

/** @var TalkRoom $data */
Expand Down
42 changes: 42 additions & 0 deletions tests/integration/features/federation/chat.feature
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,48 @@ Feature: federation/chat
| room | users | participant2 | participant2-displayname | Message deleted by you | {"actor":{"type":"user","id":"participant2","name":"participant2-displayname"}} | Message deleted by author |
| room | federated_users | participant1@{$BASE_URL} | participant1-displayname | Message deleted by author | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","server":"{$BASE_URL}"}} | |

Scenario: Read marker checking
Given the following "spreed" app config is set
| federation_enabled | yes |
Given user "participant1" creates room "room" (v4)
| roomType | 2 |
| roomName | room |
And user "participant1" adds federated_user "participant2" to room "room" with 200 (v4)
And user "participant1" adds federated_user "participant3" to room "room" with 200 (v4)
And user "participant2" has the following invitations (v1)
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
| LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
| id | name | type | remoteServer | remoteToken |
| room | room | 2 | LOCAL | room |
And user "participant3" has the following invitations (v1)
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
| LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
And user "participant3" accepts invite to room "room" of server "LOCAL" with 200 (v1)
| 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 |
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 |
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 |
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 |
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 |

Scenario: Error handling of chatting (posting a too long message)
Given the following "spreed" app config is set
| federation_enabled | yes |
Expand Down