0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/services
Simon Backx 6bd1806650
Fixed same redirectManager used in offer service between tests (#14340)
refs https://ghost.slack.com/archives/C02G9E68C/p1647599592576139
refs https://ghost.slack.com/archives/C02G9E68C/p1647620250625909

Issue: `Cannot destructure property 'fromRegex' of 'this.redirectsredirectId]' as it is undefined.` is being thrown, only when running all tests.
Cause: duplicate redirects are added to a redirectManager, and not cleared correctly in the redirectManager, which throws an error when removing one of the duplicate redirects.

Because the same redirectManager is used, multiple event listeners are connected to the same redirectManager. So when the offer service has been initialised multiple times, multiple listeners are added, which create a redirect for every newly created offer... to the same redirectManager.
So there are three possible fixes for the same problem (would be best to fix them all):
- Create a new redirectManager every time the offer service is initialised
- Figure out a way to remove DomainEvents subscribers between tests
- Don't add the same redirect id multiple times to redirectIds in addRedirect from the express-dynamic-redirects package

This commit contains a fix for the first solution.

It also moved the offers service initialising before the frontend (to `initServicesForFrontend`)
2022-03-24 10:18:52 +01:00
..
adapter-manager Added multiple adapters capability to adapter manager 2021-10-21 20:22:45 +13:00
auth 💡 Updated fixtures to make it easier to get started (#14299) 2022-03-10 17:41:46 +00:00
bulk-email Added Sentry error capture for failed email update after sending is complete 2022-02-08 18:36:14 +00:00
email-analytics Prevent an event-processing error if there is no timezone setting 2022-03-02 13:58:26 +01:00
integrations Replace GhostError with InternalServerError 2021-12-14 12:17:48 +00:00
invitations Replaced i18n with tpl in accept.js (#13471) 2021-10-08 15:21:22 +01:00
invites Revert "Revert "Extract logging from DI patterns, only use @tryghost/logging package"" (#13884) 2021-12-14 11:22:39 +00:00
jobs Revert "Revert "Extract logging from DI patterns, only use @tryghost/logging package"" (#13884) 2021-12-14 11:22:39 +00:00
mail Removed empty class attribute from emails (#13906) 2021-12-16 16:58:33 +02:00
mega Fixed horizontal scrolling issue in code blocks in emails 2022-03-18 15:26:08 +01:00
members Added the MemberCancelEvent model to MembersApi (#14313) 2022-03-18 14:25:35 +01:00
notifications Replace error handler middleware with @tryghost/mw-error-handler (#13879) 2021-12-14 15:18:46 +00:00
offers Fixed same redirectManager used in offer service between tests (#14340) 2022-03-24 10:18:52 +01:00
permissions Switch to @tryghost/errors from ignition errors package (#13807) 2021-12-01 10:22:01 +00:00
posts Added "contains" operator support to ?filter= query params (#14286) 2022-03-09 13:02:17 +00:00
public-config 🐛 Fixed config API not returning boolean 2022-01-20 18:25:41 +02:00
redirects Switch to @tryghost/errors from ignition errors package (#13807) 2021-12-01 10:22:01 +00:00
route-settings Renamed defaultSettings to defaultRouteSettings 2022-02-21 20:06:20 +13:00
settings Added settingsCache handling to e2e-framework 2022-02-11 16:24:24 +00:00
stripe 🐛 Fixed Stripe checkout session urls being invalid 2022-02-15 12:50:07 +02:00
themes Refactored the gscan version check to use single variable 2022-03-22 09:53:22 +08:00
url Added "contains" operator support to ?filter= query params (#14286) 2022-03-09 13:02:17 +00:00
webhooks Re-throw error when attempting to create webhooks 2022-03-07 13:54:00 +00:00
custom-theme-settings.js Added API tests for custom theme settings (#13519) 2021-10-08 16:18:49 +01:00
limits.js Simlified limit service initialization 2021-11-03 00:33:28 +13:00
nft-oembed.js Added fallback for NFT title when name is missing 2021-12-03 21:16:22 +02:00
oembed.js Added missing message string 2022-03-21 09:07:54 +00:00
slack.js Switch to @tryghost/errors from ignition errors package (#13807) 2021-12-01 10:22:01 +00:00
twitter-embed.js Removed richTwitterNewsletters GA labs flag 2022-01-04 13:07:39 +00:00
users.js 🔒 Added a "reset all passwords" feature (#13005) 2021-06-23 14:54:28 +02:00
xmlrpc.js Switch to @tryghost/errors from ignition errors package (#13807) 2021-12-01 10:22:01 +00:00