Skip to content

Commit c48493a

Browse files
FIX Let admin sections have same url-segment-prefix (#1974)
React admin section routing shouldn't kick in when the URL segment for an admin section starts with the same string, unless it's actually part of that same section.
1 parent 76e876f commit c48493a

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

behat.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ default:
2121
-
2222
SilverStripe\BehatExtension\Context\FixtureContext:
2323
- '%paths.modules.admin%/tests/behat/features/files/'
24+
-
25+
SilverStripe\Framework\Tests\Behaviour\ConfigContext:
26+
- '%paths.modules.admin%/tests/behat/features/files/'
2427

2528
extensions:
2629
SilverStripe\BehatExtension\MinkExtension:

client/dist/js/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/boot/BootRoutes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class BootRoutes {
9898

9999
// Check if the beginning of the route is the same as the current location.
100100
// Since we haven't decided on a router yet, we can't use it for route matching.
101-
return currentPath.match(route);
101+
return currentPath.match(`${route}(/|$)`);
102102
});
103103
}
104104

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@retry @job2
2+
Feature: Single-page routing works as expected
3+
As a content author
4+
I want to single-page-routing to work as expected
5+
So that I can get to the areas I want to get to
6+
7+
Background:
8+
Given I have a config file "fake-asset-admin.yml"
9+
And the "Employee" "Employee A" with "Email"="test@example.com" and "Biography"="<p>some content here</p>" and "DateOfBirth"="1990-06-09"
10+
And the "group" "EDITOR" has permissions "Access to 'Test ModelAdmin' section" and "TEST_DATAOBJECT_EDIT"
11+
And I am logged in as a member of "EDITOR" group
12+
13+
Scenario: Admin sections can start with the same string as a react section
14+
When I go to "/admin/assets-test"
15+
Then I should see "Add Company"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
Name: fake-asset-admin
3+
---
4+
TestModelAdmin:
5+
url_segment: 'assets-test'

0 commit comments

Comments
 (0)