🐛 Fixed 500 error when visiting an email-only post link

refs 74280cfbea

- We allow to send email-only posts when using v4 Admin API, but it's possible to configure a v3 Theme with a site instance which resulta in an unsupported behavior throwing a 500.
- With this fix a 404 will be returned when an email-only post is viewed through the public email-only post URL
This commit is contained in:
Naz 2021-10-26 16:01:10 +04:00
parent e851e28b16
commit 6e6f427149

View File

@ -108,9 +108,11 @@ class RouterManager {
this.siteRouter.mountRouter(unsubscribeRouter.router());
this.registry.setRouter('unsubscribeRouter', unsubscribeRouter);
const emailRouter = new EmailRouter(RESOURCE_CONFIG);
this.siteRouter.mountRouter(emailRouter.router());
this.registry.setRouter('emailRouter', emailRouter);
if (RESOURCE_CONFIG.QUERY.email) {
const emailRouter = new EmailRouter(RESOURCE_CONFIG);
this.siteRouter.mountRouter(emailRouter.router());
this.registry.setRouter('emailRouter', emailRouter);
}
const previewRouter = new PreviewRouter(RESOURCE_CONFIG);
this.siteRouter.mountRouter(previewRouter.router());