From 773a13fb200ff310815339df5c9d95eb855098e8 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Tue, 26 Mar 2024 22:00:53 +0100 Subject: [PATCH 1/6] Router: Only merge default menu item when same component --- libraries/src/Router/SiteRouter.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/src/Router/SiteRouter.php b/libraries/src/Router/SiteRouter.php index 601d3069db26f..81527ef26d411 100644 --- a/libraries/src/Router/SiteRouter.php +++ b/libraries/src/Router/SiteRouter.php @@ -309,6 +309,10 @@ public function parseRawRoute(&$router, &$uri) $item = $this->menu->getItem($uri->getVar('Itemid')); } else { $item = $this->menu->getDefault($this->app->getLanguage()->getTag()); + + if ($item->query['option'] != $uri->getVar('option', $item->query['option'])) { + $item = false; + } } if ($item && $item->type === 'alias') { From 8accc62b5515e7a52c38e53090d42e2f8a52a38c Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Wed, 27 Mar 2024 19:35:37 +0100 Subject: [PATCH 2/6] Update libraries/src/Router/SiteRouter.php Co-authored-by: Harald Leithner --- libraries/src/Router/SiteRouter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/src/Router/SiteRouter.php b/libraries/src/Router/SiteRouter.php index f5587ea150201..2b0207b16faa6 100644 --- a/libraries/src/Router/SiteRouter.php +++ b/libraries/src/Router/SiteRouter.php @@ -310,7 +310,7 @@ public function parseRawRoute(&$router, &$uri) } else { $item = $this->menu->getDefault($this->app->getLanguage()->getTag()); - if ($item->query['option'] != $uri->getVar('option', $item->query['option'])) { + if ($item->query['option'] !== $uri->getVar('option', $item->query['option'])) { $item = false; } } From 0198f5654d6dfef4dacd8f38d098916964b00751 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Fri, 3 May 2024 09:58:09 +0200 Subject: [PATCH 3/6] Fixing cypress test --- .../integration/site/components/com_contact/Categories.cy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/System/integration/site/components/com_contact/Categories.cy.js b/tests/System/integration/site/components/com_contact/Categories.cy.js index 678d62cb308c1..971ba46763635 100644 --- a/tests/System/integration/site/components/com_contact/Categories.cy.js +++ b/tests/System/integration/site/components/com_contact/Categories.cy.js @@ -12,8 +12,8 @@ describe('Test in frontend that the contact categories view', () => { cy.contains('automated test category 1'); cy.contains('automated test category 2'); - cy.get(':nth-child(2) > .page-header > .badge').contains('Contact Count: 1'); - cy.get(':nth-child(3) > .page-header > .badge').contains('Contact Count: 2'); + cy.get(':nth-child(1) > .page-header > .badge').contains('Contact Count: 1'); + cy.get(':nth-child(2) > .page-header > .badge').contains('Contact Count: 2'); }); }); From 3f62f021f7b51b189a143f46c12e9446daf01f41 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Sat, 11 May 2024 16:35:26 +0200 Subject: [PATCH 4/6] Another fix to unit tests --- .../integration/site/components/com_newsfeed/Categories.cy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/System/integration/site/components/com_newsfeed/Categories.cy.js b/tests/System/integration/site/components/com_newsfeed/Categories.cy.js index 854d9684eec0a..77b134dd683c9 100644 --- a/tests/System/integration/site/components/com_newsfeed/Categories.cy.js +++ b/tests/System/integration/site/components/com_newsfeed/Categories.cy.js @@ -12,8 +12,8 @@ describe('Test in frontend that the newsfeeds categories view', () => { cy.contains('automated test category 1'); cy.contains('automated test category 2'); - cy.get(':nth-child(2) > .page-header > .badge').contains('# News feeds 1'); - cy.get(':nth-child(3) > .page-header > .badge').contains('# News feeds 2'); + cy.get(':nth-child(1) > .page-header > .badge').contains('# News feeds 1'); + cy.get(':nth-child(2) > .page-header > .badge').contains('# News feeds 2'); }); }); }); From ae15ae74a6932785a5e586869ec322968d05fde7 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Fri, 19 Jul 2024 17:18:18 +0200 Subject: [PATCH 5/6] Don't merge the parameters, but set the active menu item --- libraries/src/Router/SiteRouter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/src/Router/SiteRouter.php b/libraries/src/Router/SiteRouter.php index 2b0207b16faa6..0637deaf71c0a 100644 --- a/libraries/src/Router/SiteRouter.php +++ b/libraries/src/Router/SiteRouter.php @@ -311,6 +311,8 @@ public function parseRawRoute(&$router, &$uri) $item = $this->menu->getDefault($this->app->getLanguage()->getTag()); if ($item->query['option'] !== $uri->getVar('option', $item->query['option'])) { + // Set the active menu item + $this->menu->setActive($item->id); $item = false; } } From 311a2b1b14b4008aecaf22da327dba54110cff76 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Fri, 19 Jul 2024 17:21:26 +0200 Subject: [PATCH 6/6] Reverting change to tests. --- .../integration/site/components/com_contact/Categories.cy.js | 4 ++-- .../integration/site/components/com_newsfeed/Categories.cy.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/System/integration/site/components/com_contact/Categories.cy.js b/tests/System/integration/site/components/com_contact/Categories.cy.js index 971ba46763635..678d62cb308c1 100644 --- a/tests/System/integration/site/components/com_contact/Categories.cy.js +++ b/tests/System/integration/site/components/com_contact/Categories.cy.js @@ -12,8 +12,8 @@ describe('Test in frontend that the contact categories view', () => { cy.contains('automated test category 1'); cy.contains('automated test category 2'); - cy.get(':nth-child(1) > .page-header > .badge').contains('Contact Count: 1'); - cy.get(':nth-child(2) > .page-header > .badge').contains('Contact Count: 2'); + cy.get(':nth-child(2) > .page-header > .badge').contains('Contact Count: 1'); + cy.get(':nth-child(3) > .page-header > .badge').contains('Contact Count: 2'); }); }); diff --git a/tests/System/integration/site/components/com_newsfeed/Categories.cy.js b/tests/System/integration/site/components/com_newsfeed/Categories.cy.js index 77b134dd683c9..854d9684eec0a 100644 --- a/tests/System/integration/site/components/com_newsfeed/Categories.cy.js +++ b/tests/System/integration/site/components/com_newsfeed/Categories.cy.js @@ -12,8 +12,8 @@ describe('Test in frontend that the newsfeeds categories view', () => { cy.contains('automated test category 1'); cy.contains('automated test category 2'); - cy.get(':nth-child(1) > .page-header > .badge').contains('# News feeds 1'); - cy.get(':nth-child(2) > .page-header > .badge').contains('# News feeds 2'); + cy.get(':nth-child(2) > .page-header > .badge').contains('# News feeds 1'); + cy.get(':nth-child(3) > .page-header > .badge').contains('# News feeds 2'); }); }); });