From ecd946707a6f9b2b5ca40ba3e91996dd9942b093 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 1 Mar 2024 17:10:18 +0700 Subject: [PATCH 1/4] Enhanced navigation reducer in Volto --- packages/volto/news/5772.bugfix | 1 + packages/volto/src/reducers/navigation/navigation.js | 1 + 2 files changed, 2 insertions(+) create mode 100644 packages/volto/news/5772.bugfix diff --git a/packages/volto/news/5772.bugfix b/packages/volto/news/5772.bugfix new file mode 100644 index 0000000000..240c4292da --- /dev/null +++ b/packages/volto/news/5772.bugfix @@ -0,0 +1 @@ +Enhanced navigation reducer in Volto @Hrittik20 \ No newline at end of file diff --git a/packages/volto/src/reducers/navigation/navigation.js b/packages/volto/src/reducers/navigation/navigation.js index 30693e24fe..3c304e02dc 100644 --- a/packages/volto/src/reducers/navigation/navigation.js +++ b/packages/volto/src/reducers/navigation/navigation.js @@ -34,6 +34,7 @@ function getRecursiveItems(items) { title: item.title, description: item.description, url: flattenToAppURL(item['@id']), + ...item, ...(item.items && { items: getRecursiveItems(item.items) }), })); } From 87973a001167ba1829308e35aeb0dd510c1d2eaf Mon Sep 17 00:00:00 2001 From: Hrittik <49366463+Hrittik20@users.noreply.github.com> Date: Fri, 1 Mar 2024 17:28:53 +0700 Subject: [PATCH 2/4] Update 5772.bugfix --- packages/volto/news/5772.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/volto/news/5772.bugfix b/packages/volto/news/5772.bugfix index 240c4292da..95f227953d 100644 --- a/packages/volto/news/5772.bugfix +++ b/packages/volto/news/5772.bugfix @@ -1 +1 @@ -Enhanced navigation reducer in Volto @Hrittik20 \ No newline at end of file +Enhanced navigation reducer in Volto to keep items extra-data sent from the navigation endpoint @Hrittik20 From 9649aa36bad53d4681631d1720b0a8ae7d2655f5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 3 Mar 2024 22:29:47 +0700 Subject: [PATCH 3/4] Updated navigation.test.js --- packages/volto/src/reducers/navigation/navigation.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/volto/src/reducers/navigation/navigation.test.js b/packages/volto/src/reducers/navigation/navigation.test.js index 0d289c2a79..318e85e25c 100644 --- a/packages/volto/src/reducers/navigation/navigation.test.js +++ b/packages/volto/src/reducers/navigation/navigation.test.js @@ -49,6 +49,7 @@ describe('Navigation reducer', () => { error: null, items: [ { + '@id': 'http://localhost:8080/Plone/front-page', title: 'Welcome to Plone!', description: 'Congratulations! You have successfully installed Plone.', @@ -91,17 +92,20 @@ describe('Navigation reducer', () => { error: null, items: [ { + '@id': 'http://localhost:8080/Plone/front-page', title: 'Welcome to Plone!', description: 'Congratulations! You have successfully installed Plone.', url: '/front-page', }, { + '@id': 'http://localhost:8080/Plone/folder1', title: 'Folder1', description: 'Folder description', url: '/folder1', items: [ { + '@id': 'http://localhost:8080/Plone/folderinfolder1', title: 'FolderInFolder1', description: 'Sub-folder description', url: '/folderinfolder1', @@ -162,6 +166,7 @@ describe('Navigation reducer (NAVIGATION)GET_CONTENT', () => { error: null, items: [ { + '@id': 'http://localhost:8080/Plone/front-page', title: 'Welcome to Plone!', description: 'Congratulations! You have successfully installed Plone.', @@ -192,6 +197,7 @@ describe('Navigation reducer (NAVIGATION)GET_CONTENT', () => { error: null, items: [ { + '@id': 'http://localhost:8080/Plone/front-page', title: 'Welcome to Plone!', description: 'Congratulations! You have successfully installed Plone.', From 3e926796c0033d5b6827ae1e507a5e5fbab297d6 Mon Sep 17 00:00:00 2001 From: Hrittik <49366463+Hrittik20@users.noreply.github.com> Date: Tue, 2 Apr 2024 18:42:17 +0700 Subject: [PATCH 4/4] Update packages/volto/src/reducers/navigation/navigation.js Removed title and description Co-authored-by: David Glick --- packages/volto/src/reducers/navigation/navigation.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/volto/src/reducers/navigation/navigation.js b/packages/volto/src/reducers/navigation/navigation.js index 3c304e02dc..2e00b551cc 100644 --- a/packages/volto/src/reducers/navigation/navigation.js +++ b/packages/volto/src/reducers/navigation/navigation.js @@ -31,8 +31,6 @@ const initialState = { */ function getRecursiveItems(items) { return map(items, (item) => ({ - title: item.title, - description: item.description, url: flattenToAppURL(item['@id']), ...item, ...(item.items && { items: getRecursiveItems(item.items) }),