diff --git a/appinfo/routes.php b/appinfo/routes.php index 87e15f034cf..8946fddf9b8 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -207,7 +207,7 @@ 'url' => '/api/{apiVersion}/listed-room', 'verb' => 'GET', 'requirements' => [ - 'apiVersion' => 'v3', + 'apiVersion' => 'v4', ], ], [ diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index b0d2bb000c7..99fb4e3cf57 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -229,14 +229,12 @@ public function getRooms(int $noStatusUpdate = 0): DataResponse { * @return DataResponse */ public function getListedRooms(string $searchTerm = ''): DataResponse { - $event = new UserEvent($this->userId); - $rooms = $this->manager->getListedRoomsForUser($this->userId, $searchTerm); $return = []; foreach ($rooms as $room) { try { - $return[] = $this->formatRoomV2andV3($room, null); + $return[] = $this->formatRoom($room, null); } catch (RoomNotFoundException $e) { } catch (\RuntimeException $e) { } diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 9486584223a..5884c92f7f5 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -139,59 +139,59 @@ public function tearDown() { } /** - * @Then /^user "([^"]*)" cannot find any listed rooms(?: \((v3)\))?$/ + * @Then /^user "([^"]*)" cannot find any listed rooms \((v4)\)$/ * * @param string $user * @param string $apiVersion */ - public function userCannotFindAnyListedRooms($user, $apiVersion = 'v3') { + public function userCannotFindAnyListedRooms(string $user, string $apiVersion) { $this->userCanFindListedRoomsWithTerm($user, '', $apiVersion, null); } /** - * @Then /^user "([^"]*)" cannot find any listed rooms with (\d+)(?: \((v3)\))?$/ + * @Then /^user "([^"]*)" cannot find any listed rooms with (\d+) \((v4)\)$/ * * @param string $user * @param int $statusCode * @param string $apiVersion */ - public function userCannotFindAnyListedRoomsWithStatus($user, $statusCode, $apiVersion = 'v3') { + public function userCannotFindAnyListedRoomsWithStatus(string $user, int $statusCode, string $apiVersion) { $this->setCurrentUser($user); - $this->sendRequest('GET', '/apps/spreed/api/' . $apiVersion . '/room'); + $this->sendRequest('GET', '/apps/spreed/api/' . $apiVersion . '/listed-room'); $this->assertStatusCode($this->response, $statusCode); } /** - * @Then /^user "([^"]*)" cannot find any listed rooms with term "([^"]*)"(?: \((v3)\))?$/ + * @Then /^user "([^"]*)" cannot find any listed rooms with term "([^"]*)" \((v4)\)$/ * * @param string $user * @param string $term * @param string $apiVersion */ - public function userCannotFindAnyListedRoomsWithTerm($user, $term, $apiVersion = 'v3') { + public function userCannotFindAnyListedRoomsWithTerm(string $user, string $term, string $apiVersion) { $this->userCanFindListedRoomsWithTerm($user, $term, $apiVersion, null); } /** - * @Then /^user "([^"]*)" can find listed rooms(?: \((v3)\))?$/ + * @Then /^user "([^"]*)" can find listed rooms \((v4)\)$/ * * @param string $user * @param string $apiVersion * @param TableNode|null $formData */ - public function userCanFindListedRooms($user, $apiVersion = 'v3', TableNode $formData = null) { + public function userCanFindListedRooms(string $user, string $apiVersion, TableNode $formData = null) { $this->userCanFindListedRoomsWithTerm($user, '', $apiVersion, $formData); } /** - * @Then /^user "([^"]*)" can find listed rooms with term "([^"]*)"(?: \((v3)\))?$/ + * @Then /^user "([^"]*)" can find listed rooms with term "([^"]*)" \((v4)\)$/ * * @param string $user * @param string $term * @param string $apiVersion * @param TableNode|null $formData */ - public function userCanFindListedRoomsWithTerm($user, $term, $apiVersion = 'v3', TableNode $formData = null) { + public function userCanFindListedRoomsWithTerm(string $user, string $term, string $apiVersion, TableNode $formData = null) { $this->setCurrentUser($user); $suffix = ''; if ($term !== '') { diff --git a/tests/integration/features/conversation/find-listed.feature b/tests/integration/features/conversation/find-listed.feature index 8f48de5768c..94b00d158ba 100644 --- a/tests/integration/features/conversation/find-listed.feature +++ b/tests/integration/features/conversation/find-listed.feature @@ -14,7 +14,7 @@ Feature: conversation/find-listed | roomName | public-room | When user "creator" allows listing room "group-room" for "none" with 200 And user "creator" allows listing room "public-room" for "none" with 200 - Then user "" cannot find any listed rooms (v3) + Then user "" cannot find any listed rooms (v4) Examples: | user | | creator | @@ -30,11 +30,11 @@ Feature: conversation/find-listed | roomName | public-room | When user "creator" allows listing room "group-room" for "users" with 200 And user "creator" allows listing room "public-room" for "users" with 200 - Then user "regular-user" can find listed rooms (v3) + Then user "regular-user" can find listed rooms (v4) | name | listable | | group-room | 1 | | public-room | 1 | - And user "user-guest@example.com" cannot find any listed rooms (v3) + And user "user-guest@example.com" cannot find any listed rooms (v4) Scenario: All users can find all-listed rooms Given user "creator" creates room "group-room" @@ -45,11 +45,11 @@ Feature: conversation/find-listed | roomName | public-room | When user "creator" allows listing room "group-room" for "all" with 200 And user "creator" allows listing room "public-room" for "all" with 200 - Then user "regular-user" can find listed rooms (v3) + Then user "regular-user" can find listed rooms (v4) | name | listable | | group-room | 2 | | public-room | 2 | - And user "user-guest@example.com" can find listed rooms (v3) + And user "user-guest@example.com" can find listed rooms (v4) | name | listable | | group-room | 2 | | public-room | 2 | @@ -65,7 +65,7 @@ Feature: conversation/find-listed And user "creator" allows listing room "public-room" for "users" with 200 When user "regular-user" joins room "group-room" with 200 And user "regular-user" joins room "public-room" with 200 - Then user "regular-user" cannot find any listed rooms (v3) + Then user "regular-user" cannot find any listed rooms (v4) Scenario: Participants cannot search for already joined listed rooms Given user "creator" creates room "group-room" @@ -78,7 +78,7 @@ Feature: conversation/find-listed And user "creator" allows listing room "public-room" for "users" with 200 When user "regular-user" joins room "group-room" with 200 And user "regular-user" joins room "public-room" with 200 - Then user "regular-user" cannot find any listed rooms (v3) + Then user "regular-user" cannot find any listed rooms (v4) Scenario: Users can use search terms to find listed rooms Given user "creator" creates room "group-room" @@ -97,11 +97,11 @@ Feature: conversation/find-listed And user "creator" allows listing room "public-room" for "all" with 200 And user "creator" allows listing room "group-the-cool-room" for "all" with 200 And user "creator" allows listing room "public-the-cool-room" for "all" with 200 - Then user "regular-user" can find listed rooms with term "cool" (v3) + Then user "regular-user" can find listed rooms with term "cool" (v4) | name | listable | | group-the-cool-room | 2 | | public-the-cool-room | 2 | - And user "user-guest@example.com" can find listed rooms with term "cool" (v3) + And user "user-guest@example.com" can find listed rooms with term "cool" (v4) | name | listable | | group-the-cool-room | 2 | | public-the-cool-room | 2 | @@ -111,8 +111,8 @@ Feature: conversation/find-listed | roomType | 2 | | roomName | group-room | When user "creator" allows listing room "group-room" for "all" with 200 - Then user "regular-user" cannot find any listed rooms with term "cool" (v3) - And user "user-guest@example.com" cannot find any listed rooms with term "cool" (v3) + Then user "regular-user" cannot find any listed rooms with term "cool" (v4) + And user "user-guest@example.com" cannot find any listed rooms with term "cool" (v4) Scenario: Guest users without accounts cannot search for listed rooms Given user "creator" creates room "public-room" @@ -123,4 +123,4 @@ Feature: conversation/find-listed | roomName | public-room-listed | And user "creator" allows listing room "public-room-listed" for "all" with 200 When user "guest" joins room "public-room" with 200 - Then user "guest" cannot find any listed rooms with 401 (v3) + Then user "guest" cannot find any listed rooms with 401 (v4)