apostrophecms / apostrophe-redirects

Allows admins to create redirects within an Apostrophe site
2 stars 2 forks source link

PRO-2504: middleware can now find redirects across locales #31

Closed boutell closed 2 years ago

boutell commented 2 years ago

Summary

It turns out that enabling workflow for the redirects module does often make sense because it allows you to choose an internal page to link to in a particular locale. However, our redirect middleware was not able to find redirects in locales other than the default locale, unless the slug being redirected from coincidentally had the right prefix.

This logic has been overhauled to use raw mongodb queries to bypass the usual locale restriction, which also improves performance for this very frequently used code path.

What are the specific steps to test this change?

In apostrophe-enterprise-testbed, a redirect created in the fr domain now works even if its trigger URL has no /fr prefix and the user was not previously in the fr domain.

What kind of change does this PR introduce?

(Check at least one)

Make sure the PR fulfills these requirements:

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

linear[bot] commented 2 years ago
PRO-2504 [P'unk] Project Bread Redirects

See details here: [https://apostrophecms.atlassian.net/browse/SD-393](https://apostrophecms.atlassian.net/browse/SD-393) 1\. Removing redirects from workflow: Both projectbread.org and gettingsnap.org have redirects under Workflow, and we would like them to be excluded.\ 2\. Consolidating Redirects: On gettingsnap.org, there are currently redirects both in the application and in Mechanic, which were implemented as a stopgap. Once the redirects are out of Workflow, we’d like to consolidate these in whatever method Apostrophe suggests. \ 3\. Testing