0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00
ghost/core/server
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
..
adapters Switch to @tryghost/errors from ignition errors package (#13807) 2021-12-01 10:22:01 +00:00
api Removed unnecessary authors serializer 2022-03-23 14:09:24 +00:00
data Enabled Admin integration for tiers and offers API (#14325) 2022-03-16 16:46:26 +05:30
lib Updated probe-image-size options to reflect underlying change 2022-03-09 20:27:38 +00:00
models Added the MemberCancelEvent model 2022-03-11 21:50:06 +01:00
services Fixed same redirectManager used in offer service between tests (#14340) 2022-03-24 10:18:52 +01:00
views Updated unsubscribe page 2022-03-10 10:39:20 +00:00
web Fixed theme error handler (#14363) 2022-03-22 15:32:55 +00:00
analytics-events.js
ghost-server.js Switch to @tryghost/errors from ignition errors package (#13807) 2021-12-01 10:22:01 +00:00
notify.js Removed unused import 2021-12-06 08:17:07 +00:00
overrides.js
run-update-check.js Revert "Revert "Extract logging from DI patterns, only use @tryghost/logging package"" (#13884) 2021-12-14 11:22:39 +00:00
update-check.js Added library for extracting database information 2022-01-18 09:31:08 +00:00