From 6f857ef3f6eb968530d7610e1f232119b27d6270 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Mon, 13 Jun 2022 10:35:49 +0200
Subject: [PATCH] hotline #158491 fix edit menu link in front

---
 VERSIONS_HOTLINE/158491                                     | 1 +
 .../Intonation/Library/Widget/Carousel/Menu/View.php        | 4 +---
 tests/scenarios/Templates/ChiliTest.php                     | 6 ++++++
 tests/scenarios/Templates/TemplatesTest.php                 | 2 +-
 tests/scenarios/Widgets/WidgetsTest.php                     | 2 +-
 5 files changed, 10 insertions(+), 5 deletions(-)
 create mode 100644 VERSIONS_HOTLINE/158491

diff --git a/VERSIONS_HOTLINE/158491 b/VERSIONS_HOTLINE/158491
new file mode 100644
index 00000000000..ee5d7f01d4f
--- /dev/null
+++ b/VERSIONS_HOTLINE/158491
@@ -0,0 +1 @@
+ - correctif #158491 : Magasin de thèmes : Correction des liens de modifications des menus en interface publique.
\ No newline at end of file
diff --git a/library/templates/Intonation/Library/Widget/Carousel/Menu/View.php b/library/templates/Intonation/Library/Widget/Carousel/Menu/View.php
index b5c3eb4881e..c1092c321b1 100644
--- a/library/templates/Intonation/Library/Widget/Carousel/Menu/View.php
+++ b/library/templates/Intonation/Library/Widget/Carousel/Menu/View.php
@@ -43,9 +43,7 @@ class Intonation_Library_Widget_Carousel_Menu_View extends Intonation_Library_Wi
       return null;
 
     return $this->_menu_cache =
-      $menu
-      ->setParent($this->getId())
-      ->setParentInstance($this);
+      $menu->setParentInstance($this);
   }
 
 
diff --git a/tests/scenarios/Templates/ChiliTest.php b/tests/scenarios/Templates/ChiliTest.php
index 8e1eeff9e7d..382cb70bfb6 100644
--- a/tests/scenarios/Templates/ChiliTest.php
+++ b/tests/scenarios/Templates/ChiliTest.php
@@ -149,6 +149,12 @@ class ChiliTemplateProfilePatcherTest extends ChiliTemplateTestCase {
     $this->assertXPath('//div[contains(@class, "top_highlight_carousel")]',
                        $this->_response->getBody());
   }
+
+
+  /** @test */
+  public function editNavMenuLinkShouldNotHaveParentParam() {
+    $this->assertXPath('//div//nav/following-sibling::div[@class="configuration_module"]//a[@href= "/admin/widget/edit-menu/id/0/id_profil/1?backUrl=%2F"]');
+  }
 }
 
 
diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php
index 55c237cefa1..08fe6920546 100644
--- a/tests/scenarios/Templates/TemplatesTest.php
+++ b/tests/scenarios/Templates/TemplatesTest.php
@@ -2164,7 +2164,7 @@ class TemplateIntonationWithSkinTest extends TemplatesEnabledTestCase {
 
   /** @test */
   public function editMenuLinkProfileIdShouldBe72() {
-    $this->assertXPath('//a[contains(@href, "/admin/widget/edit-menu/id/0/id_profil/72")]');
+    $this->assertXPath('//a[@href= "/admin/widget/edit-menu/id/0/id_profil/72/parent/0?backUrl=%2Findex%2Findex%2Fid_profil%2F72"]');
   }
 
 
diff --git a/tests/scenarios/Widgets/WidgetsTest.php b/tests/scenarios/Widgets/WidgetsTest.php
index 1cd9b9ae140..c696292a2b6 100644
--- a/tests/scenarios/Widgets/WidgetsTest.php
+++ b/tests/scenarios/Widgets/WidgetsTest.php
@@ -91,7 +91,7 @@ class WidgetsNavEditLinkInFrontTest extends WidgetsNavSimpleTestCase {
 
   /** @test */
   public function linkToEditNavShouldBePopupReady() {
-    $this->assertXPath('//div[@id="menu_horizontal"]//a[contains(@href, "/admin/widget/edit-menu/id/H/id_profil/2")][@data-popup="true"]');
+    $this->assertXPath('//div[@id="menu_horizontal"]//a[@href= "/admin/widget/edit-menu/id/2/id_profil/2/parent/H?backUrl=%2F"][@data-popup="true"]');
   }
 
 
-- 
GitLab