Ghost/core/server
Kevin Ansfield 8ad384d7f8 🐛 Fixed scheduled post emails pointing at /404/ for the "view online" link
no issue

When scheduling a post to publish+send the "view online" link was pointing at https://site.com/404/ rather than the published post's url.

The problem occurred because the `/schedules/` endpoint wraps it's post read+edit calls in a transaction. Context:
- when a post is published with with the "send email" option the email record is immediately generated and added to the API response, as part of the email record generation we render the email content including fetching the url for the "view online" link
- urls for all resources are handled by our `url` service, that service updates it's internal cache based upon model events such as the "edited" event triggered when a post is published
- if the posts API controller is given a transaction, the email record is also generated inside of that transaction however at this point the `url` service will not have been updated because the post record hasn't been committed meaning it has no available url for the post

Fix:
- removed the `models.Base.transaction()` wrapper around the post read+update in the `/schedules/` API controllers
- we don't need a transaction here. It was added as protection against another write request coming in between the `/schedules/` controller reading a post and publishing a post but we already have protection against that in the form of collision detection - if a write request comes in and commits between the schedules controller reading the post and updating it, the scheduler's update call will fail with a collision error at which point the scheduler itself should retry the request which could then publish the post successfully if everything else is in order
2020-10-08 10:26:49 +01:00
..
adapters Replaced constants file with @tryghost/constants 2020-08-11 12:51:16 +01:00
api 🐛 Fixed scheduled post emails pointing at /404/ for the "view online" link 2020-10-08 10:26:49 +01:00
data Added migration to store from/reply-to values in email table (#12204) 2020-09-24 08:20:10 +01:00
lib Extracted promise libs and history into @tryghost/promise 2020-08-11 18:44:21 +01:00
models Store email batch and recipient records when sending newsletters (#12195) 2020-09-29 17:17:54 +01:00
public 🐛 Fixed members form missing data-members-name (#12250) 2020-10-01 18:05:23 +01:00
services 🐛 Fixed email card replacements showing raw replacement text in emails 2020-10-05 17:24:48 +01:00
translations Updated Webhook API error message 2020-09-28 13:24:47 +02:00
views Updated head to only output custom favicons (#11949) 2020-06-30 15:07:08 +01:00
web Updated all Origin header checks to handle 'null' (#12246) 2020-10-01 09:37:22 +01:00
analytics-events.js Moved config from server to shared (#11850) 2020-05-27 18:47:53 +01:00
ghost-server.js Improved testmode logging of shutdown status 2020-08-18 15:48:42 +01:00
index.js Added routes.yaml content checksum storage to the db 2020-09-10 10:54:57 +12:00
overrides.js Disabled bluebird debug logs 2018-08-13 14:01:31 +02:00
update-check.js Moved core/server/lib/common/logging to core/shared/logging (#11857) 2020-05-28 19:30:23 +01:00