diff --git a/appinfo/info.xml b/appinfo/info.xml index 2108f0004de..19678f34576 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -16,7 +16,7 @@ And in the works for the [coming versions](https://github.com/nextcloud/spreed/m ]]> - 11.0.0-dev.7 + 11.0.0-dev.8 agpl Daniel Calviño Sánchez diff --git a/appinfo/routes.php b/appinfo/routes.php index 1e1f2259173..1148c4db9e3 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -236,6 +236,15 @@ 'token' => '^[a-z0-9]{4,30}$', ], ], + [ + 'name' => 'Room#setDescription', + 'url' => '/api/{apiVersion}/room/{token}/description', + 'verb' => 'PUT', + 'requirements' => [ + 'apiVersion' => 'v3', + 'token' => '^[a-z0-9]{4,30}$', + ], + ], [ 'name' => 'Room#setReadOnly', 'url' => '/api/{apiVersion}/room/{token}/read-only', diff --git a/docs/conversation.md b/docs/conversation.md index a87107e76df..9de4ea23389 100644 --- a/docs/conversation.md +++ b/docs/conversation.md @@ -29,6 +29,7 @@ `type` | int | * | See list of conversation types in the [constants list](constants.md#Conversation-types) `name` | string | * | Name of the conversation (can also be empty) `displayName` | string | * | `name` if non empty, otherwise it falls back to a list of participants + `description` | string | v3 | Description of the conversation (can also be empty) `participantType` | int | * | Permissions level of the current user `attendeeId` | int | v3 | Unique attendee id `attendeePin` | string | v3 | Unique dial-in authentication code for this user, when the conversation has SIP enabled (see `sipEnabled` attribute) @@ -132,6 +133,25 @@ + `403 Forbidden` When the current user is not a moderator/owner + `404 Not Found` When the conversation could not be found for the participant +## Set description for a conversation + +* Method: `PUT` +* API: v3 +* Endpoint: `/room/{token}/description` +* Data: + + field | type | Description + ------|------|------------ + `description` | string | New description for the conversation + +* Response: + - Status code: + + `200 OK` + + `400 Bad Request` When the description is too long + + `400 Bad Request` When the conversation is a one to one conversation + + `403 Forbidden` When the current user is not a moderator/owner + + `404 Not Found` When the conversation could not be found for the participant + ## Allow guests in a conversation (public conversation) * Method: `POST` diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index cde11bcc5b0..b840dd8d248 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -120,6 +120,20 @@ public function parseMessage(Message $chatMessage): void { } elseif ($cliIsActor) { $parsedMessage = $this->l->t('An administrator renamed the conversation from "%1$s" to "%2$s"', [$parameters['oldName'], $parameters['newName']]); } + } elseif ($message === 'description_set') { + $parsedMessage = $this->l->t('{actor} set the description to "%1$s"', [$parameters['newDescription']]); + if ($currentUserIsActor) { + $parsedMessage = $this->l->t('You set the description to "%1$s"', [$parameters['newDescription']]); + } elseif ($cliIsActor) { + $parsedMessage = $this->l->t('An administrator set the description to "%1$s"', [$parameters['newDescription']]); + } + } elseif ($message === 'description_removed') { + $parsedMessage = $this->l->t('{actor} removed the description'); + if ($currentUserIsActor) { + $parsedMessage = $this->l->t('You removed the description'); + } elseif ($cliIsActor) { + $parsedMessage = $this->l->t('An administrator removed the description'); + } } elseif ($message === 'call_started') { $parsedMessage = $this->l->t('{actor} started a call'); if ($currentUserIsActor) { diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php index e45ab3a5a55..6c019b90aba 100644 --- a/lib/Chat/SystemMessage/Listener.php +++ b/lib/Chat/SystemMessage/Listener.php @@ -123,6 +123,19 @@ public static function register(IEventDispatcher $dispatcher): void { 'oldName' => $event->getOldValue(), ]); }); + $dispatcher->addListener(Room::EVENT_AFTER_DESCRIPTION_SET, static function (ModifyRoomEvent $event) { + $room = $event->getRoom(); + /** @var self $listener */ + $listener = \OC::$server->get(self::class); + + if ($event->getNewValue() !== '') { + $listener->sendSystemMessage($room, 'description_set', [ + 'newDescription' => $event->getNewValue(), + ]); + } else { + $listener->sendSystemMessage($room, 'description_removed'); + } + }); $dispatcher->addListener(Room::EVENT_AFTER_PASSWORD_SET, static function (ModifyRoomEvent $event) { $room = $event->getRoom(); /** @var self $listener */ diff --git a/lib/Command/Room/Create.php b/lib/Command/Room/Create.php index 3634e179cfa..7d595cb2f7a 100644 --- a/lib/Command/Room/Create.php +++ b/lib/Command/Room/Create.php @@ -45,6 +45,11 @@ protected function configure(): void { 'name', InputArgument::REQUIRED, 'The name of the room to create' + )->addOption( + 'description', + null, + InputOption::VALUE_REQUIRED, + 'The description of the room to create' )->addOption( 'user', null, @@ -85,6 +90,7 @@ protected function configure(): void { protected function execute(InputInterface $input, OutputInterface $output): int { $name = $input->getArgument('name'); + $description = $input->getOption('description'); $users = $input->getOption('user'); $groups = $input->getOption('group'); $public = $input->getOption('public'); @@ -105,6 +111,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int } try { + if ($description !== null) { + $this->setRoomDescription($room, $description); + } + $this->setRoomReadOnly($room, $readonly); if ($password !== null) { diff --git a/lib/Command/Room/TRoomCommand.php b/lib/Command/Room/TRoomCommand.php index b69c4e5e321..f2986232025 100644 --- a/lib/Command/Room/TRoomCommand.php +++ b/lib/Command/Room/TRoomCommand.php @@ -105,6 +105,20 @@ protected function validateRoomName(string $name): bool { return (($name !== '') && !isset($name[255])); } + /** + * @param Room $room + * @param string $description + * + * @throws InvalidArgumentException + */ + protected function setRoomDescription(Room $room, string $description): void { + try { + $room->setDescription($description); + } catch (\LengthException $e) { + throw new InvalidArgumentException('Invalid room description.'); + } + } + /** * @param Room $room * @param bool $public diff --git a/lib/Command/Room/Update.php b/lib/Command/Room/Update.php index 77ce4028f28..76480a116a6 100644 --- a/lib/Command/Room/Update.php +++ b/lib/Command/Room/Update.php @@ -51,6 +51,11 @@ protected function configure(): void { null, InputOption::VALUE_REQUIRED, 'Sets a new name for the room' + )->addOption( + 'description', + null, + InputOption::VALUE_REQUIRED, + 'Sets a new description for the room' )->addOption( 'public', null, @@ -77,6 +82,7 @@ protected function configure(): void { protected function execute(InputInterface $input, OutputInterface $output): int { $token = $input->getArgument('token'); $name = $input->getOption('name'); + $description = $input->getOption('description'); $public = $input->getOption('public'); $readOnly = $input->getOption('readonly'); $password = $input->getOption('password'); @@ -109,6 +115,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->setRoomName($room, $name); } + if ($description !== null) { + $this->setRoomDescription($room, $description); + } + if ($public !== null) { $this->setRoomPublic($room, ($public === '1')); } diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index a6c1de71809..6b4e1b3af72 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -548,6 +548,7 @@ protected function formatRoomV2andV3(Room $room, ?Participant $currentParticipan 'attendeeId' => 0, 'canEnableSIP' => false, 'attendeePin' => '', + 'description' => '', ]); } @@ -616,6 +617,7 @@ protected function formatRoomV2andV3(Room $room, ?Participant $currentParticipan 'actorType' => $attendee->getActorType(), 'actorId' => $attendee->getActorId(), 'attendeeId' => $attendee->getId(), + 'description' => $room->getDescription(), ]); } @@ -997,6 +999,27 @@ public function renameRoom(string $roomName): DataResponse { return new DataResponse(); } + /** + * @PublicPage + * @RequireModeratorParticipant + * + * @param string $description + * @return DataResponse + */ + public function setDescription(string $description): DataResponse { + if ($this->room->getType() === Room::ONE_TO_ONE_CALL) { + return new DataResponse([], Http::STATUS_BAD_REQUEST); + } + + try { + $this->room->setDescription($description); + } catch (\LengthException $exception) { + return new DataResponse([], Http::STATUS_BAD_REQUEST); + } + + return new DataResponse(); + } + /** * @PublicPage * @RequireModeratorParticipant diff --git a/lib/Manager.php b/lib/Manager.php index 84f6faad0b2..f5ea5ccd6d1 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -172,6 +172,7 @@ public function createRoomObject(array $row): Room { $assignedSignalingServer, (string) $row['token'], (string) $row['name'], + (string) $row['description'], (string) $row['password'], (int) $row['active_guests'], $activeSince, diff --git a/lib/Migration/Version11000Date20201011082810.php b/lib/Migration/Version11000Date20201011082810.php new file mode 100644 index 00000000000..7714c2a8106 --- /dev/null +++ b/lib/Migration/Version11000Date20201011082810.php @@ -0,0 +1,58 @@ + + * + * @author Daniel Calviño Sánchez + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Talk\Migration; + +use Closure; +use Doctrine\DBAL\Types\Type; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version11000Date20201011082810 extends SimpleMigrationStep { + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @return null|ISchemaWrapper + */ + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + $table = $schema->getTable('talk_rooms'); + if (!$table->hasColumn('description')) { + $table->addColumn('description', Type::TEXT, [ + 'notnull' => false, + 'default' => '', + ]); + + return $schema; + } + + return null; + } +} diff --git a/lib/Room.php b/lib/Room.php index ee655156f0e..8f9ed227806 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -74,6 +74,8 @@ class Room { public const EVENT_AFTER_ROOM_DELETE = self::class . '::postDeleteRoom'; public const EVENT_BEFORE_NAME_SET = self::class . '::preSetName'; public const EVENT_AFTER_NAME_SET = self::class . '::postSetName'; + public const EVENT_BEFORE_DESCRIPTION_SET = self::class . '::preSetDescription'; + public const EVENT_AFTER_DESCRIPTION_SET = self::class . '::postSetDescription'; public const EVENT_BEFORE_PASSWORD_SET = self::class . '::preSetPassword'; public const EVENT_AFTER_PASSWORD_SET = self::class . '::postSetPassword'; public const EVENT_BEFORE_TYPE_SET = self::class . '::preSetType'; @@ -107,6 +109,8 @@ class Room { public const EVENT_AFTER_SESSION_LEAVE_CALL = self::class . '::postSessionLeaveCall'; public const EVENT_BEFORE_SIGNALING_PROPERTIES = self::class . '::beforeSignalingProperties'; + public const DESCRIPTION_MAXIMUM_LENGTH = 500; + /** @var Manager */ private $manager; /** @var IDBConnection */ @@ -139,6 +143,8 @@ class Room { /** @var string */ private $name; /** @var string */ + private $description; + /** @var string */ private $password; /** @var int */ private $activeGuests; @@ -174,6 +180,7 @@ public function __construct(Manager $manager, ?int $assignedSignalingServer, string $token, string $name, + string $description, string $password, int $activeGuests, \DateTime $activeSince = null, @@ -197,6 +204,7 @@ public function __construct(Manager $manager, $this->assignedSignalingServer = $assignedSignalingServer; $this->token = $token; $this->name = $name; + $this->description = $description; $this->password = $password; $this->activeGuests = $activeGuests; $this->activeSince = $activeSince; @@ -276,6 +284,10 @@ public function getDisplayName(string $userId): string { return $this->manager->resolveRoomDisplayName($this, $userId); } + public function getDescription(): string { + return $this->description; + } + public function getActiveGuests(): int { return $this->activeGuests; } @@ -324,9 +336,10 @@ public function setParticipant(?string $userId, Participant $participant): void * Return the room properties to send to the signaling server. * * @param string $userId + * @param bool $roomModified * @return array */ - public function getPropertiesForSignaling(string $userId): array { + public function getPropertiesForSignaling(string $userId, bool $roomModified = true): array { $properties = [ 'name' => $this->getDisplayName($userId), 'type' => $this->getType(), @@ -337,6 +350,12 @@ public function getPropertiesForSignaling(string $userId): array { 'sip-enabled' => $this->getSIPEnabled(), ]; + if ($roomModified) { + $properties = array_merge($properties, [ + 'description' => $this->getDescription(), + ]); + } + $event = new SignalingRoomPropertiesEvent($this, $userId, $properties); $this->dispatcher->dispatch(self::EVENT_BEFORE_SIGNALING_PROPERTIES, $event); return $event->getProperties(); @@ -540,6 +559,38 @@ public function setName(string $newName, ?string $oldName = null): bool { return true; } + /** + * @param string $description + * @return bool True when the change was valid, false otherwise + * @throws \LengthException when the given description is too long + */ + public function setDescription(string $description): bool { + $description = trim($description); + + if (mb_strlen($description) > self::DESCRIPTION_MAXIMUM_LENGTH) { + throw new \LengthException('Conversation description is limited to ' . self::DESCRIPTION_MAXIMUM_LENGTH . ' characters'); + } + + $oldDescription = $this->getDescription(); + if ($description === $oldDescription) { + return false; + } + + $event = new ModifyRoomEvent($this, 'description', $description, $oldDescription); + $this->dispatcher->dispatch(self::EVENT_BEFORE_DESCRIPTION_SET, $event); + + $query = $this->db->getQueryBuilder(); + $query->update('talk_rooms') + ->set('description', $query->createNamedParameter($description)) + ->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT))); + $query->execute(); + $this->description = $description; + + $this->dispatcher->dispatch(self::EVENT_AFTER_DESCRIPTION_SET, $event); + + return true; + } + /** * @param string $password Currently it is only allowed to have a password for Room::PUBLIC_CALL * @return bool True when the change was valid, false otherwise diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php index e1429f9e90f..f850a22f697 100644 --- a/lib/Signaling/BackendNotifier.php +++ b/lib/Signaling/BackendNotifier.php @@ -159,7 +159,7 @@ public function roomInvited(Room $room, array $users): void { // TODO(fancycode): We should try to get rid of 'alluserids' and // find a better way to notify existing users to update the room. 'alluserids' => $this->participantService->getParticipantUserIds($room), - 'properties' => $room->getPropertiesForSignaling(''), + 'properties' => $room->getPropertiesForSignaling('', false), ], ]); } @@ -180,7 +180,7 @@ public function roomsDisinvited(Room $room, array $userIds): void { // TODO(fancycode): We should try to get rid of 'alluserids' and // find a better way to notify existing users to update the room. 'alluserids' => $this->participantService->getParticipantUserIds($room), - 'properties' => $room->getPropertiesForSignaling(''), + 'properties' => $room->getPropertiesForSignaling('', false), ], ]); } @@ -201,7 +201,7 @@ public function roomSessionsRemoved(Room $room, array $sessionIds): void { // TODO(fancycode): We should try to get rid of 'alluserids' and // find a better way to notify existing users to update the room. 'alluserids' => $this->participantService->getParticipantUserIds($room), - 'properties' => $room->getPropertiesForSignaling(''), + 'properties' => $room->getPropertiesForSignaling('', false), ], ]); } diff --git a/lib/Signaling/Listener.php b/lib/Signaling/Listener.php index 8bdc251a985..f62d3200522 100644 --- a/lib/Signaling/Listener.php +++ b/lib/Signaling/Listener.php @@ -136,6 +136,7 @@ protected static function registerExternalSignaling(IEventDispatcher $dispatcher $notifier->roomModified($event->getRoom()); }; $dispatcher->addListener(Room::EVENT_AFTER_NAME_SET, $listener); + $dispatcher->addListener(Room::EVENT_AFTER_DESCRIPTION_SET, $listener); $dispatcher->addListener(Room::EVENT_AFTER_PASSWORD_SET, $listener); $dispatcher->addListener(Room::EVENT_AFTER_TYPE_SET, $listener); $dispatcher->addListener(Room::EVENT_AFTER_READONLY_SET, $listener); diff --git a/tests/integration/features/bootstrap/CommandLineTrait.php b/tests/integration/features/bootstrap/CommandLineTrait.php index 973dd213b59..d35315ec18b 100644 --- a/tests/integration/features/bootstrap/CommandLineTrait.php +++ b/tests/integration/features/bootstrap/CommandLineTrait.php @@ -46,6 +46,10 @@ trait CommandLineTrait { * @return int exit code */ public function runOcc($args = []) { + // Set UTF-8 locale to ensure that escapeshellarg will not strip + // multibyte characters. + setlocale(LC_CTYPE, "C.UTF-8"); + $args = array_map(function ($arg) { return escapeshellarg($arg); }, $args); diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index ff28b7f3ea2..7bdd49fb1ac 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -162,6 +162,9 @@ private function assertRooms($rooms, TableNode $formData) { if (isset($expectedRoom['name'])) { $data['name'] = $room['name']; } + if (isset($expectedRoom['description'])) { + $data['description'] = $room['description']; + } if (isset($expectedRoom['type'])) { $data['type'] = (string) $room['type']; } @@ -174,6 +177,15 @@ private function assertRooms($rooms, TableNode $formData) { if (isset($expectedRoom['participantType'])) { $data['participantType'] = (string) $room['participantType']; } + if (isset($expectedRoom['sipEnabled'])) { + $data['sipEnabled'] = (string) $room['sipEnabled']; + } + if (isset($expectedRoom['attendeePin'])) { + $data['attendeePin'] = $room['attendeePin'] ? '**PIN**' : ''; + } + if (isset($expectedRoom['lastMessage'])) { + $data['lastMessage'] = $room['lastMessage'] ? $room['lastMessage']['message'] : ''; + } if (isset($expectedRoom['participants'])) { $participantNames = array_map(function ($participant) { return $participant['name']; @@ -200,12 +212,6 @@ private function assertRooms($rooms, TableNode $formData) { } $data['participants'] = implode(', ', $participantNames); } - if (isset($expectedRoom['sipEnabled'])) { - $data['sipEnabled'] = (string) $room['sipEnabled']; - } - if (isset($expectedRoom['attendeePin'])) { - $data['attendeePin'] = $room['attendeePin'] ? '**PIN**' : ''; - } return $data; }, $rooms, $formData->getHash())); @@ -662,6 +668,25 @@ public function userRenamesRoom($user, $identifier, $newName, $statusCode, $apiV $this->assertStatusCode($this->response, $statusCode); } + /** + * @When /^user "([^"]*)" sets description for room "([^"]*)" to "([^"]*)" with (\d+)(?: \((v(1|2|3))\))?$/ + * + * @param string $user + * @param string $identifier + * @param string $description + * @param string $statusCode + * @param string $apiVersion + * @param TableNode + */ + public function userSetsDescriptionForRoomTo($user, $identifier, $description, $statusCode, $apiVersion = 'v3') { + $this->setCurrentUser($user); + $this->sendRequest( + 'PUT', '/apps/spreed/api/' .$apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/description', + new TableNode([['description', $description]]) + ); + $this->assertStatusCode($this->response, $statusCode); + } + /** * @When /^user "([^"]*)" sets password "([^"]*)" for room "([^"]*)" with (\d+)(?: \((v(1|2|3))\))?$/ * diff --git a/tests/integration/features/chat/system-messages.feature b/tests/integration/features/chat/system-messages.feature index 8252d56c6d5..22166c62a24 100644 --- a/tests/integration/features/chat/system-messages.feature +++ b/tests/integration/features/chat/system-messages.feature @@ -25,6 +25,28 @@ Feature: System messages | room | users | participant1 | participant1-displayname | conversation_renamed | | room | users | participant1 | participant1-displayname | conversation_created | + Scenario: Set a description + Given user "participant1" creates room "room" + | roomType | 2 | + | roomName | room | + When user "participant1" sets description for room "room" to "New description" with 200 + Then user "participant1" sees the following system messages in room "room" with 200 + | room | actorType | actorId | actorDisplayName | systemMessage | + | room | users | participant1 | participant1-displayname | description_set | + | room | users | participant1 | participant1-displayname | conversation_created | + + Scenario: Removes a description + Given user "participant1" creates room "room" + | roomType | 2 | + | roomName | room | + And user "participant1" sets description for room "room" to "New description" with 200 + When user "participant1" sets description for room "room" to "" with 200 + Then user "participant1" sees the following system messages in room "room" with 200 + | room | actorType | actorId | actorDisplayName | systemMessage | + | room | users | participant1 | participant1-displayname | description_removed | + | room | users | participant1 | participant1-displayname | description_set | + | room | users | participant1 | participant1-displayname | conversation_created | + Scenario: Toggle guests Given user "participant1" creates room "room" | roomType | 2 | diff --git a/tests/integration/features/command/create.feature b/tests/integration/features/command/create.feature index 4148a7aec8a..5463769aa34 100644 --- a/tests/integration/features/command/create.feature +++ b/tests/integration/features/command/create.feature @@ -6,7 +6,7 @@ Feature: create Given group "group1" exists Given user "participant2" is member of group "group1" - Scenario: Create a room group room for participant1 + Scenario: Create a group room for participant1 Given invoking occ with "talk:room:create room1 --user participant1" And the command output contains the text "Room successfully created" Then the command was successful @@ -14,7 +14,7 @@ Feature: create | name | type | participantType | participants | | room1 | 2 | 3 | participant1-displayname | - Scenario: Create a room group room for participant1 as moderator + Scenario: Create a group room for participant1 as moderator Given invoking occ with "talk:room:create room1 --user participant1 --moderator participant1" And the command output contains the text "Room successfully created" Then the command was successful @@ -22,7 +22,7 @@ Feature: create | name | type | participantType | participants | | room1 | 2 | 2 | participant1-displayname | - Scenario: Create a room group room for participant1 as owner + Scenario: Create a group room for participant1 as owner Given invoking occ with "talk:room:create room1 --user participant1 --owner participant1" And the command output contains the text "Room successfully created" Then the command was successful @@ -30,7 +30,7 @@ Feature: create | name | type | participantType | participants | | room1 | 2 | 1 | participant1-displayname | - Scenario: Create a room public room for participant1 as owner group1 as users + Scenario: Create a public room for participant1 as owner group1 as users Given invoking occ with "talk:room:create room1 --user participant1 --owner participant1 --public --group group1" And the command output contains the text "Room successfully created" Then the command was successful @@ -41,7 +41,7 @@ Feature: create | name | type | participantType | participants | | room1 | 3 | 3 | participant1-displayname, participant2-displayname | - Scenario: Create a room public room for participant1 as owner group1 as users with password and readonly + Scenario: Create a public room for participant1 as owner group1 as users with password and readonly Given invoking occ with "talk:room:create room1 --user participant1 --owner participant1 --public --group group1 --readonly --password test" And the command output contains the text "Room successfully created" Then the command was successful @@ -51,3 +51,31 @@ Feature: create And user "participant2" is participant of the following rooms | name | type | readOnly | hasPassword | participantType | participants | | room1 | 3 | 1 | 1 | 3 | participant1-displayname, participant2-displayname | + + + + Scenario: Create a public room for participant1 as owner with a description of 500 characters + When invoking occ with "talk:room:create room1 --user participant1 --owner participant1 --public --description 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C" + Then the command was successful + And the command output contains the text "Room successfully created" + And user "participant1" is participant of the following rooms (v3) + | name | type | participantType | description | + | room1 | 3 | 1 | 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C | + + Scenario: Create a public room for participant1 as owner with a description of more than 500 characters + When invoking occ with "talk:room:create room1 --user participant1 --owner participant1 --public --description 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C1" + Then the command failed with exit code 1 + And the command output contains the text "Invalid room description" + + Scenario: Create a public room for participant1 as owner with a description of 500 multibyte characters + When invoking occ with "talk:room:create room1 --user participant1 --owner participant1 --public --description ०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च" + Then the command was successful + And the command output contains the text "Room successfully created" + And user "participant1" is participant of the following rooms (v3) + | name | type | participantType | description | + | room1 | 3 | 1 | ०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च | + + Scenario: Create a public room for participant1 as owner with a description of more than 500 multibyte characters + When invoking occ with "talk:room:create room1 --user participant1 --owner participant1 --public --description ०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०" + Then the command failed with exit code 1 + And the command output contains the text "Invalid room description" diff --git a/tests/integration/features/conversation/lobby.feature b/tests/integration/features/conversation/lobby.feature index 32e9f951376..5adba5f7a60 100644 --- a/tests/integration/features/conversation/lobby.feature +++ b/tests/integration/features/conversation/lobby.feature @@ -210,3 +210,42 @@ Feature: conversation/lobby And user "guest2" joins room "room" with 200 And user "participant2" removes themselves from room "room" with 200 And user "participant3" removes themselves from room "room" with 200 + + + + # Not all the values are checked in the test, only the most relevant ones + Scenario: participants can get some room information when the lobby is active + Given user "participant1" creates room "room" + | roomType | 3 | + | roomName | room | + And user "participant1" adds "participant2" to room "room" with 200 + And user "participant1" promotes "participant2" in room "room" with 200 + And user "participant1" adds "participant3" to room "room" with 200 + And user "participant1" joins room "room" with 200 + And user "participant2" joins room "room" with 200 + And user "participant3" joins room "room" with 200 + And user "participant4" joins room "room" with 200 + And user "guest" joins room "room" with 200 + And user "participant1" promotes "guest" in room "room" with 200 + And user "guest2" joins room "room" with 200 + When user "participant1" sets lobby state for room "room" to "non moderators" with 200 + And user "participant1" sends message "Message 1" to room "room" with 201 + And user "participant1" sets description for room "room" to "the description" with 200 + Then user "participant1" is participant of room "room" (v3) + | name | description | type | participantType | lastMessage | + | room | the description | 3 | 1 | You set the description to "the description" | + And user "participant2" is participant of room "room" (v3) + | name | description | type | participantType | lastMessage | + | room | the description | 3 | 2 | {actor} set the description to "the description" | + And user "participant3" is participant of room "room" (v3) + | name | description | type | participantType | lastMessage | + | room | the description | 3 | 3 | | + And user "participant4" is participant of room "room" (v3) + | name | description | type | participantType | lastMessage | + | room | the description | 3 | 5 | | + And user "guest" is participant of room "room" (v3) + | name | description | type | participantType | lastMessage | + | room | the description | 3 | 6 | {actor} set the description to "the description" | + And user "guest2" is participant of room "room" (v3) + | name | description | type | participantType | lastMessage | + | room | the description | 3 | 4 | | diff --git a/tests/integration/features/conversation/set-description.feature b/tests/integration/features/conversation/set-description.feature new file mode 100644 index 00000000000..a335ebc9065 --- /dev/null +++ b/tests/integration/features/conversation/set-description.feature @@ -0,0 +1,345 @@ +Feature: set-description + Background: + Given user "owner" exists + Given user "moderator" exists + Given user "invited user" exists + Given user "not invited but joined user" exists + Given user "not joined user" exists + + Scenario: a description of 500 characters can be set + Given user "owner" creates room "group room" + | roomType | 2 | + | roomName | room | + When user "owner" sets description for room "group room" to "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C" with 200 + Then user "owner" is participant of room "group room" (v3) + | description | + | 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C | + + Scenario: a description longer than 500 characters can not be set + Given user "owner" creates room "group room" + | roomType | 2 | + | roomName | room | + And user "owner" sets description for room "group room" to "the description" with 200 + When user "owner" sets description for room "group room" to "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C0" with 400 + Then user "owner" is participant of room "group room" (v3) + | description | + | the description | + + Scenario: a description of 500 multibyte characters can be set + Given user "owner" creates room "group room" + | roomType | 2 | + | roomName | room | + When user "owner" sets description for room "group room" to "०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च" with 200 + Then user "owner" is participant of room "group room" (v3) + | description | + | ०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च | + + Scenario: a description longer than 500 multibyte characters can not be set + Given user "owner" creates room "group room" + | roomType | 2 | + | roomName | room | + And user "owner" sets description for room "group room" to "the description" with 200 + When user "owner" sets description for room "group room" to "०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०" with 400 + Then user "owner" is participant of room "group room" (v3) + | description | + | the description | + + + + Scenario: owner can not set description in one-to-one room + Given user "owner" creates room "one-to-one room" + | roomType | 1 | + | invite | moderator | + When user "owner" sets description for room "one-to-one room" to "the description" with 400 + And user "moderator" sets description for room "one-to-one room" to "the description" with 400 + Then user "owner" is participant of room "one-to-one room" (v3) + | description | + | | + And user "moderator" is participant of room "one-to-one room" (v3) + | description | + | | + + + + Scenario: owner can set description in group room + Given user "owner" creates room "group room" + | roomType | 2 | + | roomName | room | + And user "owner" adds "moderator" to room "group room" with 200 + And user "owner" promotes "moderator" in room "group room" with 200 + And user "owner" adds "invited user" to room "group room" with 200 + When user "owner" sets description for room "group room" to "the description" with 200 + Then user "owner" is participant of room "group room" (v3) + | description | + | the description | + And user "moderator" is participant of room "group room" (v3) + | description | + | the description | + And user "invited user" is participant of room "group room" (v3) + | description | + | the description | + + Scenario: moderator can set description in group room + Given user "owner" creates room "group room" + | roomType | 2 | + | roomName | room | + And user "owner" adds "moderator" to room "group room" with 200 + And user "owner" promotes "moderator" in room "group room" with 200 + And user "owner" adds "invited user" to room "group room" with 200 + When user "moderator" sets description for room "group room" to "the description" with 200 + Then user "owner" is participant of room "group room" (v3) + | description | + | the description | + And user "moderator" is participant of room "group room" (v3) + | description | + | the description | + And user "invited user" is participant of room "group room" (v3) + | description | + | the description | + + Scenario: others can not set description in group room + Given user "owner" creates room "group room" + | roomType | 2 | + | roomName | room | + And user "owner" adds "moderator" to room "group room" with 200 + And user "owner" promotes "moderator" in room "group room" with 200 + And user "owner" adds "invited user" to room "group room" with 200 + And user "owner" sets description for room "group room" to "the description" with 200 + When user "invited user" sets description for room "group room" to "invited user description" with 403 + And user "not invited user" sets description for room "group room" to "not invited user description" with 404 + # Guest user names in tests must being with "guest" + And user "guest not joined" sets description for room "group room" to "guest not joined description" with 404 + Then user "owner" is participant of room "group room" (v3) + | description | + | the description | + And user "moderator" is participant of room "group room" (v3) + | description | + | the description | + And user "invited user" is participant of room "group room" (v3) + | description | + | the description | + + + + Scenario: owner can set description in public room + Given user "owner" creates room "public room" + | roomType | 3 | + | roomName | room | + And user "owner" adds "moderator" to room "public room" with 200 + And user "owner" promotes "moderator" in room "public room" with 200 + And user "owner" adds "invited user" to room "public room" with 200 + And user "not invited but joined user" joins room "public room" with 200 + And user "guest moderator" joins room "public room" with 200 + And user "owner" promotes "guest moderator" in room "public room" with 200 + And user "guest" joins room "public room" with 200 + When user "owner" sets description for room "public room" to "the description" with 200 + Then user "owner" is participant of room "public room" (v3) + | description | + | the description | + And user "moderator" is participant of room "public room" (v3) + | description | + | the description | + And user "invited user" is participant of room "public room" (v3) + | description | + | the description | + And user "not invited but joined user" is participant of room "public room" (v3) + | description | + | the description | + And user "guest moderator" is participant of room "public room" (v3) + | description | + | the description | + And user "guest" is participant of room "public room" (v3) + | description | + | the description | + + Scenario: moderator can set description in public room + Given user "owner" creates room "public room" + | roomType | 3 | + | roomName | room | + And user "owner" adds "moderator" to room "public room" with 200 + And user "owner" promotes "moderator" in room "public room" with 200 + And user "owner" adds "invited user" to room "public room" with 200 + And user "not invited but joined user" joins room "public room" with 200 + And user "guest moderator" joins room "public room" with 200 + And user "owner" promotes "guest moderator" in room "public room" with 200 + And user "guest" joins room "public room" with 200 + When user "moderator" sets description for room "public room" to "the description" with 200 + Then user "owner" is participant of room "public room" (v3) + | description | + | the description | + And user "moderator" is participant of room "public room" (v3) + | description | + | the description | + And user "invited user" is participant of room "public room" (v3) + | description | + | the description | + And user "not invited but joined user" is participant of room "public room" (v3) + | description | + | the description | + And user "guest moderator" is participant of room "public room" (v3) + | description | + | the description | + And user "guest" is participant of room "public room" (v3) + | description | + | the description | + + Scenario: guest moderator can set description in public room + Given user "owner" creates room "public room" + | roomType | 3 | + | roomName | room | + And user "owner" adds "moderator" to room "public room" with 200 + And user "owner" promotes "moderator" in room "public room" with 200 + And user "owner" adds "invited user" to room "public room" with 200 + And user "not invited but joined user" joins room "public room" with 200 + And user "guest moderator" joins room "public room" with 200 + And user "owner" promotes "guest moderator" in room "public room" with 200 + And user "guest" joins room "public room" with 200 + When user "guest moderator" sets description for room "public room" to "the description" with 200 + Then user "owner" is participant of room "public room" (v3) + | description | + | the description | + And user "moderator" is participant of room "public room" (v3) + | description | + | the description | + And user "invited user" is participant of room "public room" (v3) + | description | + | the description | + And user "not invited but joined user" is participant of room "public room" (v3) + | description | + | the description | + And user "guest moderator" is participant of room "public room" (v3) + | description | + | the description | + And user "guest" is participant of room "public room" (v3) + | description | + | the description | + + Scenario: others can not set description in public room + Given user "owner" creates room "public room" + | roomType | 3 | + | roomName | room | + And user "owner" adds "moderator" to room "public room" with 200 + And user "owner" promotes "moderator" in room "public room" with 200 + And user "owner" adds "invited user" to room "public room" with 200 + And user "not invited but joined user" joins room "public room" with 200 + And user "guest moderator" joins room "public room" with 200 + And user "owner" promotes "guest moderator" in room "public room" with 200 + And user "guest" joins room "public room" with 200 + And user "owner" sets description for room "public room" to "the description" with 200 + When user "invited user" sets description for room "public room" to "invited user description" with 403 + And user "not invited but joined user" sets description for room "public room" to "not invited but joined description" with 403 + And user "not joined user" sets description for room "public room" to "not joined user description" with 404 + And user "guest" sets description for room "public room" to "guest description" with 403 + # Guest user names in tests must being with "guest" + And user "guest not joined" sets description for room "public room" to "guest not joined description" with 404 + Then user "owner" is participant of room "public room" (v3) + | description | + | the description | + And user "moderator" is participant of room "public room" (v3) + | description | + | the description | + And user "invited user" is participant of room "public room" (v3) + | description | + | the description | + And user "not invited but joined user" is participant of room "public room" (v3) + | description | + | the description | + And user "guest moderator" is participant of room "public room" (v3) + | description | + | the description | + And user "guest" is participant of room "public room" (v3) + | description | + | the description | + + + + Scenario: participants can not set description in room for a share + # These users are only needed in very specific tests, so they are not + # created in the background step. + Given user "owner of file" exists + And user "user with access to file" exists + And user "owner of file" shares "welcome.txt" with user "user with access to file" with OCS 100 + And user "user with access to file" accepts last share + And user "owner of file" shares "welcome.txt" by link with OCS 100 + And user "guest" gets the room for last share with 200 + And user "owner of file" joins room "file last share room" with 200 + And user "user with access to file" joins room "file last share room" with 200 + And user "guest" joins room "file last share room" with 200 + When user "owner of file" sets description for room "file last share room" to "owner of file description" with 403 + And user "user with access to file" sets description for room "file last share room" to "user with access to file description" with 403 + And user "guest" sets description for room "file last share room" to "guest description" with 403 + Then user "owner of file" is participant of room "file last share room" (v3) + | description | + | | + And user "user with access to file" is participant of room "file last share room" (v3) + | description | + | | + And user "guest" is participant of room "file last share room" (v3) + | description | + | | + + + + Scenario: owner can set description in a password request room + # The user is only needed in very specific tests, so it is not created in + # the background step. + Given user "owner of file" exists + And user "owner of file" shares "welcome.txt" by link with OCS 100 + | password | 123456 | + | sendPasswordByTalk | true | + And user "guest" creates the password request room for last share with 201 + And user "guest" joins room "password request for last share room" with 200 + And user "owner of file" joins room "password request for last share room" with 200 + When user "owner of file" sets description for room "password request for last share room" to "the description" with 200 + Then user "owner of file" is participant of room "password request for last share room" (v3) + | description | + | the description | + And user "guest" is participant of room "password request for last share room" (v3) + | description | + | the description | + + + + Scenario: room list returns the description if the description is set + Given user "owner" creates room "public room" + | roomType | 3 | + | roomName | room | + And user "owner" adds "moderator" to room "public room" with 200 + And user "owner" promotes "moderator" in room "public room" with 200 + And user "owner" adds "invited user" to room "public room" with 200 + And user "not invited but joined user" joins room "public room" with 200 + When user "owner" sets description for room "public room" to "the description" with 200 + Then user "owner" is participant of the following rooms (v3) + | name | description | + | room | the description | + And user "moderator" is participant of the following rooms (v3) + | name | description | + | room | the description | + And user "invited user" is participant of the following rooms (v3) + | name | description | + | room | the description | + And user "not invited but joined user" is participant of the following rooms (v3) + | name | description | + | room | the description | + + Scenario: room list returns an empty value if the description is not set + Given user "owner" creates room "public room" + | roomType | 3 | + | roomName | room | + And user "owner" adds "moderator" to room "public room" with 200 + And user "owner" promotes "moderator" in room "public room" with 200 + And user "owner" adds "invited user" to room "public room" with 200 + And user "not invited but joined user" joins room "public room" with 200 + When user "owner" sets description for room "public room" to "" with 200 + Then user "owner" is participant of the following rooms (v3) + | name | description | + | room | | + And user "moderator" is participant of the following rooms (v3) + | name | description | + | room | | + And user "invited user" is participant of the following rooms (v3) + | name | description | + | room | | + And user "not invited but joined user" is participant of the following rooms (v3) + | name | description | + | room | | diff --git a/tests/php/Chat/Parser/SystemMessageTest.php b/tests/php/Chat/Parser/SystemMessageTest.php index 96c679b0e93..e23e1fb5a1e 100644 --- a/tests/php/Chat/Parser/SystemMessageTest.php +++ b/tests/php/Chat/Parser/SystemMessageTest.php @@ -137,6 +137,22 @@ public function dataParseMessage(): array { 'You renamed the conversation from "old" to "new"', ['actor' => ['id' => 'actor', 'type' => 'user']], ], + ['description_set', ['newDescription' => 'New description'], 'recipient', + '{actor} set the description to "New description"', + ['actor' => ['id' => 'actor', 'type' => 'user']], + ], + ['description_set', ['newDescription' => 'New description'], 'actor', + 'You set the description to "New description"', + ['actor' => ['id' => 'actor', 'type' => 'user']], + ], + ['description_removed', [], 'recipient', + '{actor} removed the description', + ['actor' => ['id' => 'actor', 'type' => 'user']], + ], + ['description_removed', [], 'actor', + 'You removed the description', + ['actor' => ['id' => 'actor', 'type' => 'user']], + ], ['call_started', [], 'recipient', '{actor} started a call', ['actor' => ['id' => 'actor', 'type' => 'user']], diff --git a/tests/php/RoomTest.php b/tests/php/RoomTest.php index 024138c9283..db5bebd8d31 100644 --- a/tests/php/RoomTest.php +++ b/tests/php/RoomTest.php @@ -68,6 +68,7 @@ public function testVerifyPassword() { null, 'foobar', 'Test', + 'description', 'passy', 0, null, diff --git a/tests/php/Signaling/BackendNotifierTest.php b/tests/php/Signaling/BackendNotifierTest.php index 47777bbb744..2af62fb7264 100644 --- a/tests/php/Signaling/BackendNotifierTest.php +++ b/tests/php/Signaling/BackendNotifierTest.php @@ -305,6 +305,30 @@ public function testRoomNameChanged() { ], 'properties' => [ 'name' => $room->getDisplayName(''), + 'description' => '', + 'type' => $room->getType(), + 'lobby-state' => Webinary::LOBBY_NONE, + 'lobby-timer' => null, + 'read-only' => Room::READ_WRITE, + 'active-since' => null, + 'sip-enabled' => 0, + ], + ], + ]); + } + + public function testRoomDescriptionChanged() { + $room = $this->manager->createRoom(Room::PUBLIC_CALL); + $room->setDescription('The description'); + + $this->assertMessageWasSent($room, [ + 'type' => 'update', + 'update' => [ + 'userids' => [ + ], + 'properties' => [ + 'name' => $room->getDisplayName(''), + 'description' => 'The description', 'type' => $room->getType(), 'lobby-state' => Webinary::LOBBY_NONE, 'lobby-timer' => null, @@ -327,6 +351,7 @@ public function testRoomPasswordChanged() { ], 'properties' => [ 'name' => $room->getDisplayName(''), + 'description' => '', 'type' => $room->getType(), 'lobby-state' => Webinary::LOBBY_NONE, 'lobby-timer' => null, @@ -349,6 +374,7 @@ public function testRoomTypeChanged() { ], 'properties' => [ 'name' => $room->getDisplayName(''), + 'description' => '', 'type' => $room->getType(), 'lobby-state' => Webinary::LOBBY_NONE, 'lobby-timer' => null, @@ -371,6 +397,7 @@ public function testRoomReadOnlyChanged() { ], 'properties' => [ 'name' => $room->getDisplayName(''), + 'description' => '', 'type' => $room->getType(), 'lobby-state' => Webinary::LOBBY_NONE, 'lobby-timer' => null, @@ -393,6 +420,7 @@ public function testRoomLobbyStateChanged() { ], 'properties' => [ 'name' => $room->getDisplayName(''), + 'description' => '', 'type' => $room->getType(), 'lobby-state' => Webinary::LOBBY_NON_MODERATORS, 'lobby-timer' => null, @@ -551,6 +579,7 @@ public function testRoomPropertiesEvent(): void { ], 'properties' => [ 'name' => $room->getDisplayName(''), + 'description' => '', 'type' => $room->getType(), 'lobby-state' => Webinary::LOBBY_NONE, 'lobby-timer' => null,