- Issue created by @lauriii
- Assigned to lauriii
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 11:32am 1 June 2023 - last update
over 1 year ago 29,392 pass, 2 fail - last update
over 1 year ago 29,402 pass, 1 fail The last submitted patch, 3: 3364088-3-test-only.patch, failed testing. View results →
The last submitted patch, 3: 3364088-3.patch, failed testing. View results →
- last update
over 1 year ago 106 pass, 1 fail The last submitted patch, 6: 3359494-6-fast.patch, failed testing. View results →
- last update
over 1 year ago 29,402 pass, 2 fail - last update
over 1 year ago 29,391 pass, 3 fail - 🇫🇮Finland lauriii Finland
The other bug I discovered is that Views generates incorrect destination paths when Drupal is in a subdirectory. The fix is on the same method and is covered by the test coverage being added here so probably better to fix it here. I also can't integration test the originally reported bug without fixing this.
The last submitted patch, 8: 3364088-8.patch, failed testing. View results →
The last submitted patch, 9: 3364088-9.patch, failed testing. View results →
- Status changed to Needs work
over 1 year ago 5:50pm 1 June 2023 - 🇫🇮Finland lauriii Finland
This should address the failing tests. I tried to add a unit test to
\Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest
to test with base path but turns out setting up\Symfony\Component\HttpFoundation\Request
with a base path is not super straight forward and mocking it doesn't seem super handy either. 😬 - Status changed to Needs review
over 1 year ago 5:50pm 1 June 2023 - last update
over 1 year ago 29,403 pass - Status changed to RTBC
over 1 year ago 9:58pm 1 June 2023 - 🇺🇸United States smustgrave
Confirmed the issue described in the issue summary.
Patch #12 solved the issue.
- 🇦🇺Australia mstrelan
@lauriii++
Patch looks good and fixes the issue I reported in #2253257-164: Use a modal for entity delete operation links → . RTBC++
- 🇺🇸United States tim.plunkett Philadelphia
Reviewed this as a subsystem maintainer of both AJAX and Views.
-
+++ b/core/lib/Drupal/Core/Pager/PagerParameters.php @@ -36,7 +36,7 @@ public function getQueryParameters() { - $request->query->all(), ['page'] + $request->query->all(), ['page', 'ajax_page_state'] +++ b/core/modules/views/src/Controller/ViewAjaxController.php @@ -162,17 +162,21 @@ public function ajaxView(Request $request) { + unset($param_union['ajax_page_state']); +++ b/core/modules/views/src/ViewExecutable.php @@ -705,7 +705,7 @@ public function getExposedInput() { - foreach (['page', 'q'] as $key) { + foreach (['page', 'q', 'ajax_page_state'] as $key) {
These are 3 sensible places to do this. Especially glad to see the change to PagerParameters
-
+++ b/core/modules/views/src/Controller/ViewAjaxController.php @@ -162,17 +162,21 @@ public function ajaxView(Request $request) { - $origin_destination = $path; + $origin_destination = $request_clone->getBasePath() . '/' . ltrim($path ?? '/', '/');
Nice :)
-
+++ b/core/modules/views/tests/src/FunctionalJavascript/PaginationAJAXTest.php @@ -100,6 +100,9 @@ public function testBasicPagination() { + // Test that no unwanted parameters are added to the URL. + $this->assertEquals('?status=All&type=All&langcode=All&items_per_page=5&order=changed&sort=asc&page=2', $link->getAttribute('href'));
This assertion was incorrectly removed in #956186-152: Allow AJAX to use GET requests → , glad to see it restored here
-
+++ b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php @@ -224,7 +224,7 @@ public function testAjaxViewViewPathNoSlash() { - ->with('test-page?ajax_page_state=drupal.settings%5B%5D&type=article'); + ->with('/test-page?type=article');
Confirmed that adding this slash here does NOT change the intention or coverage of the test. This is a side-effect of normalizing the path with that ltrim above.
RTBC++
-
- 🇫🇮Finland olli
The other bug I discovered is that Views generates incorrect destination paths when Drupal is in a subdirectory. The fix is on the same method and is covered by the test coverage being added here so probably better to fix it here.
Nice! This has been reported also in 🐛 In subsite setup view_path is not correct for links on AJAX page refresh Closed: duplicate .
- 🇫🇮Finland lauriii Finland
Thanks @olli! I tried to look for an issue for that but looks like I didn't try hard enough. 😅 Moving credits from 🐛 In subsite setup view_path is not correct for links on AJAX page refresh Closed: duplicate to here.
- last update
over 1 year ago 29,412 pass - Status changed to Fixed
over 1 year ago 9:50am 5 June 2023 - 🇬🇧United Kingdom catch
Thanks for finding and fixing the bug I introduced...
I think it would be nice if we could eventually centralise taking out ajax_page_state from incoming request URLs, but that might be something that could be looked at in 📌 Compress ajax_page_state Fixed , definitely not here.
Committed/pushed to 11.x and 10.1.x, thanks!
- 🇺🇸United States dmurphy1
Hey all, thanks for your work on this! I just wanted to flag that I create a new issue that I think may be related but doesn't appear to be resolved when testing on 10.1.x-dev: https://www.drupal.org/project/drupal/issues/3366287 🐛 [regression] Inserting media via the media library modal when paged redirects to the wrong destination Fixed .
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
over 1 year ago 8:57pm 5 July 2023 - 🇨🇭Switzerland berdir Switzerland
Aaand there's another one: 🐛 Ajax state leaking to Views bulk operations Fixed
- 🇬🇧United Kingdom altcom_neil
Thanks for working on this, here is a D9.5.x backport of patch #11
- 🇧🇾Belarus Yury N
Another issue with destination path for subdirectory installation. If you also have language prefix in path it is lost:
/subdirectory/de/admin/content/media
becomes/subdirectory/admin/content/media