diff --git a/lib/Dashboard/TalkWidget.php b/lib/Dashboard/TalkWidget.php index ca86e6703d5..34f820d213b 100644 --- a/lib/Dashboard/TalkWidget.php +++ b/lib/Dashboard/TalkWidget.php @@ -179,9 +179,10 @@ public function getItemsV2(string $userId, ?string $since = null, int $limit = 7 $rooms = []; $mentions = []; foreach ($allRooms as $room) { - if ($room->getObjectType() !== BreakoutRoom::PARENT_OBJECT_TYPE) { - $rooms[] = $room; + if ($room->getObjectType() === BreakoutRoom::PARENT_OBJECT_TYPE) { + continue; } + $rooms[] = $room; $participant = $this->participantService->getParticipant($room, $userId); $attendee = $participant->getAttendee(); diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 466022b3cb3..8bc716d4cf5 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -2322,7 +2322,7 @@ public function userGetsDashboardWidgets($user, $apiVersion = 'v1', TableNode $f } /** - * @Then /^user "([^"]*)" sees the following entries for dashboard widgets "([^"]*)"(?: \((v1)\))$/ + * @Then /^user "([^"]*)" sees the following entries for dashboard widgets "([^"]*)"(?: \((v1|v2)\))$/ * * @param string $user * @param string $widgetId @@ -2339,12 +2339,18 @@ public function userGetsDashboardWidgetItems($user, $widgetId, $apiVersion = 'v1 Assert::assertArrayHasKey($widgetId, $data); $expectedItems = $formData->getColumnsHash(); + if ($apiVersion === 'v1') { + $actualItems = $data[$widgetId]; + } else { + $actualItems = $data[$widgetId]['items']; + } + if (empty($expectedItems)) { - Assert::assertEmpty($data[$widgetId]); + Assert::assertEmpty($actualItems); return; } - Assert::assertCount(count($expectedItems), $data[$widgetId]); + Assert::assertCount(count($expectedItems), $actualItems); foreach ($expectedItems as $key => $item) { $token = self::$identifierToToken[$item['link']]; @@ -2352,11 +2358,11 @@ public function userGetsDashboardWidgetItems($user, $widgetId, $apiVersion = 'v1 $item['iconUrl'] = str_replace('{$BASE_URL}', $this->baseUrl, $item['iconUrl']); $item['iconUrl'] = str_replace('{token}', $token, $item['iconUrl']); - Assert::assertMatchesRegularExpression('/\?v=\w{8}$/', $data[$widgetId][$key]['iconUrl']); - preg_match('/(?\?v=\w{8})$/', $data[$widgetId][$key]['iconUrl'], $matches); + Assert::assertMatchesRegularExpression('/\?v=\w{8}$/', $actualItems[$key]['iconUrl']); + preg_match('/(?\?v=\w{8})$/', $actualItems[$key]['iconUrl'], $matches); $item['iconUrl'] = str_replace('{version}', $matches['version'], $item['iconUrl']); - Assert::assertEquals($item, $data[$widgetId][$key], 'Wrong details for item #' . $key); + Assert::assertEquals($item, $actualItems[$key], 'Wrong details for item #' . $key); } } diff --git a/tests/integration/features/integration/dashboard.feature b/tests/integration/features/integration/dashboard.feature index c8f521d59b7..233ba534acd 100644 --- a/tests/integration/features/integration/dashboard.feature +++ b/tests/integration/features/integration/dashboard.feature @@ -11,6 +11,8 @@ Feature: integration/dashboard Scenario: User gets the dashboard widget content When user "participant1" sees the following entries for dashboard widgets "spreed" (v1) | title | subtitle | link | iconUrl | + When user "participant1" sees the following entries for dashboard widgets "spreed" (v2) + | title | subtitle | link | iconUrl | Given user "participant2" creates room "one-to-one room" (v4) | roomType | 1 | | invite | participant1 | @@ -40,3 +42,8 @@ Feature: integration/dashboard | call room | Call in progress | call room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | | | group room | You were mentioned | group room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | | | participant2-displayname | Hello | one-to-one room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | | + Then user "participant1" sees the following entries for dashboard widgets "spreed" (v2) + | title | subtitle | link | iconUrl | sinceId | overlayIconUrl | + | call room | Call in progress | call room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | | + | group room | You were mentioned | group room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | | + | participant2-displayname | Hello | one-to-one room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |