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
4 changes: 2 additions & 2 deletions lib/Service/RoomService.php
Original file line number Diff line number Diff line change
Expand Up @@ -756,10 +756,10 @@ public function verifyPassword(Room $room, string $password): array {
}

/**
* @throws InvalidArgumentException When the room is a breakout room
* @throws InvalidArgumentException When the room is a breakout room or the room is a former one-to-one conversation
*/
public function setMessageExpiration(Room $room, int $seconds): void {
if ($room->getObjectType() === BreakoutRoom::PARENT_OBJECT_TYPE) {
if ($room->getObjectType() === BreakoutRoom::PARENT_OBJECT_TYPE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) {
throw new InvalidArgumentException('room');
}

Expand Down
15 changes: 15 additions & 0 deletions tests/integration/features/chat-1/message-expiration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,18 @@ Feature: chat/message-expiration
| room | actorType | actorId | actorDisplayName | message | messageParameters | parentMessage |
And user "participant1" gets last share
And the OCS status code should be 404

Scenario: Cannot set message expiration in a former one to one room
Given user "participant1" creates room "room" (v4)
| roomType | 1 |
| invite | participant2 |
And user "participant1" is participant of room "room" (v4)
And user "participant2" is participant of room "room" (v4)
Then user "participant1" is participant of the following rooms (v4)
| id | type | participantType |
| room | 1 | 1 |
When user "participant2" is deleted
Then user "participant1" is participant of the following rooms (v4)
| id | type | participantType |
| room | 5 | 1 |
And user "participant1" set the message expiration to 3 of room "room" with 400 (v4)