-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branch: refs/heads/main Date: 2024-09-21T09:08:30-07:00 Author: Steve Piercy (stevepiercy) <[email protected]> Commit: plone/plone.restapi@682567a Revert duplication of pip install -r requirements-docs.txt in GitHub … (#1817) * Revert duplication of pip install -r requirements-docs.txt in GitHub workflow * news * Delete news/1817.internal --------- Co-authored-by: David Glick <[email protected]> Files changed: M .github/workflows/tests.yml
- Loading branch information
Showing
1 changed file
with
10 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,38 +2,24 @@ Repository: plone.restapi | |
|
||
|
||
Branch: refs/heads/main | ||
Date: 2024-09-20T17:06:15-07:00 | ||
Author: Mauro Amico (mamico) <mauro.amico@gmail.com> | ||
Commit: https://github.com/plone/plone.restapi/commit/913f49b7e48f6e7dc3dbea5ea72428611d16e796 | ||
Date: 2024-09-21T09:08:30-07:00 | ||
Author: Steve Piercy (stevepiercy) <web@stevepiercy.com> | ||
Commit: https://github.com/plone/plone.restapi/commit/682567a86b9fc022fbad32e27906475c5410eee1 | ||
|
||
fix show_excluded_items in @navigation api (#1816) | ||
Revert duplication of pip install -r requirements-docs.txt in GitHub … (#1817) | ||
|
||
* fix show_excluded_items in @navigation api | ||
* Revert duplication of pip install -r requirements-docs.txt in GitHub workflow | ||
|
||
* changelog | ||
* news | ||
|
||
* black | ||
|
||
* revert pyenv | ||
|
||
* typo | ||
|
||
Co-authored-by: Steve Piercy <[email protected]> | ||
|
||
* Update 1816.bugfix | ||
|
||
Co-authored-by: Steve Piercy <[email protected]> | ||
|
||
* fix tests | ||
* Delete news/1817.internal | ||
|
||
--------- | ||
|
||
Co-authored-by: Steve Piercy <web@stevepiercy.com> | ||
Co-authored-by: David Glick <david@glicksoftware.com> | ||
|
||
Files changed: | ||
A news/1816.bugfix | ||
M src/plone/restapi/services/navigation/get.py | ||
M src/plone/restapi/tests/test_services_navigation.py | ||
M .github/workflows/tests.yml | ||
|
||
b'diff --git a/news/1816.bugfix b/news/1816.bugfix\nnew file mode 100644\nindex 000000000..2bb52fc58\n--- /dev/null\n+++ b/news/1816.bugfix\n@@ -0,0 +1,2 @@\n+Fix incorrect condition for ``show_excluded_items`` setting in the ``@navigation`` API.\n+[mamico]\ndiff --git a/src/plone/restapi/services/navigation/get.py b/src/plone/restapi/services/navigation/get.py\nindex 665f22da0..a21a52abe 100644\n--- a/src/plone/restapi/services/navigation/get.py\n+++ b/src/plone/restapi/services/navigation/get.py\n@@ -135,7 +135,9 @@ def navtree(self):\n if brain_parent_path == navtree_path:\n # This should be already provided by the portal_tabs_view\n continue\n- if brain.exclude_from_nav and not context_path.startswith(brain_path):\n+ if brain.exclude_from_nav and not f"{brain_path}/".startswith(\n+ f"{context_path}/"\n+ ):\n # skip excluded items if they\'re not in our context path\n continue\n url = brain.getURL()\ndiff --git a/src/plone/restapi/tests/test_services_navigation.py b/src/plone/restapi/tests/test_services_navigation.py\nindex dc466bc38..890c5c122 100644\n--- a/src/plone/restapi/tests/test_services_navigation.py\n+++ b/src/plone/restapi/tests/test_services_navigation.py\n@@ -124,6 +124,43 @@ def test_dont_broke_with_contents_without_review_state(self):\n )\n self.assertIsNone(response.json()["items"][1]["items"][3]["review_state"])\n \n+ def test_show_excluded_items(self):\n+ registry = getUtility(IRegistry)\n+ settings = registry.forInterface(INavigationSchema, prefix="plone")\n+\n+ # Plone 5.2 and Plone 6.0 have different default values:\n+ # False for Plone 6.0 and True for Plone 5.2\n+ # explicitly set the value to False to avoid test failures\n+ settings.show_excluded_items = False\n+ createContentInContainer(\n+ self.folder,\n+ "Folder",\n+ id="excluded-subfolder",\n+ title="Excluded SubFolder",\n+ exclude_from_nav=True,\n+ )\n+ transaction.commit()\n+ response = self.api_session.get(\n+ "/folder/@navigation", params={"expand.navigation.depth": 2}\n+ )\n+ self.assertNotIn(\n+ "Excluded SubFolder",\n+ [item["title"] for item in response.json()["items"][1]["items"]],\n+ )\n+\n+ # change setting to show excluded items\n+ registry = getUtility(IRegistry)\n+ settings = registry.forInterface(INavigationSchema, prefix="plone")\n+ settings.show_excluded_items = True\n+ transaction.commit()\n+ response = self.api_session.get(\n+ "/folder/@navigation", params={"expand.navigation.depth": 2}\n+ )\n+ self.assertIn(\n+ "Excluded SubFolder",\n+ [item["title"] for item in response.json()["items"][1]["items"]],\n+ )\n+\n def test_navigation_sorting(self):\n registry = getUtility(IRegistry)\n registry["plone.displayed_types"] = (\n' | ||
b'diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml\nindex 64f7dc2ee..73447527b 100644\n--- a/.github/workflows/tests.yml\n+++ b/.github/workflows/tests.yml\n@@ -60,7 +60,7 @@ jobs:\n \n # build sphinx\n - name: sphinx\n- run: if [ "${{ matrix.plone-version }}" == "6.0" ] && [ ${{ matrix.python-version }} == \'3.12\' ]; then pip install -r requirements-docs.txt && make docs-html; fi\n+ run: if [ "${{ matrix.plone-version }}" == "6.0" ] && [ ${{ matrix.python-version }} == \'3.12\' ]; then make docs-html; fi\n \n # test\n - name: test\n' | ||
|