Browse Source

fix: Cannot set message expiration in former 1:1 rooms

Signed-off-by: skalidindi53 <s.teja2004@gmail.com>
pull/12892/head
skalidindi53 1 year ago
parent
commit
3d8568b770
  1. 4
      lib/Service/RoomService.php
  2. 15
      tests/integration/features/chat-1/message-expiration.feature

4
lib/Service/RoomService.php

@ -756,10 +756,10 @@ class RoomService {
}
/**
* @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');
}

15
tests/integration/features/chat-1/message-expiration.feature

@ -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)
Loading…
Cancel
Save