mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Fixed previews not reflecting changes to scheduled posts on Ghost(Pro) (#10601)
closes https://github.com/TryGhost/Ghost/issues/10600 - modifies conditions for when to send a cache invalidation header for preview URLs to include changes to scheduled posts
This commit is contained in:
parent
458a57b09d
commit
507d8b32db
@ -132,10 +132,15 @@ module.exports = {
|
||||
query(frame) {
|
||||
return models.Post.edit(frame.data.pages[0], frame.options)
|
||||
.then((model) => {
|
||||
if (model.get('status') === 'published' && model.wasChanged() ||
|
||||
model.get('status') === 'draft' && model.previous('status') === 'published') {
|
||||
if (
|
||||
model.get('status') === 'published' && model.wasChanged() ||
|
||||
model.get('status') === 'draft' && model.previous('status') === 'published'
|
||||
) {
|
||||
this.headers.cacheInvalidate = true;
|
||||
} else if (model.get('status') === 'draft' && model.previous('status') !== 'published') {
|
||||
} else if (
|
||||
model.get('status') === 'draft' && model.previous('status') !== 'published' ||
|
||||
model.get('status') === 'scheduled' && model.wasChanged()
|
||||
) {
|
||||
this.headers.cacheInvalidate = {
|
||||
value: urlService.utils.urlFor({
|
||||
relativeUrl: urlService.utils.urlJoin('/p', model.get('uuid'), '/')
|
||||
|
@ -136,10 +136,15 @@ module.exports = {
|
||||
query(frame) {
|
||||
return models.Post.edit(frame.data.posts[0], frame.options)
|
||||
.then((model) => {
|
||||
if (model.get('status') === 'published' && model.wasChanged() ||
|
||||
model.get('status') === 'draft' && model.previous('status') === 'published') {
|
||||
if (
|
||||
model.get('status') === 'published' && model.wasChanged() ||
|
||||
model.get('status') === 'draft' && model.previous('status') === 'published'
|
||||
) {
|
||||
this.headers.cacheInvalidate = true;
|
||||
} else if (model.get('status') === 'draft' && model.previous('status') !== 'published') {
|
||||
} else if (
|
||||
model.get('status') === 'draft' && model.previous('status') !== 'published' ||
|
||||
model.get('status') === 'scheduled' && model.wasChanged()
|
||||
) {
|
||||
this.headers.cacheInvalidate = {
|
||||
value: urlService.utils.urlFor({
|
||||
relativeUrl: urlService.utils.urlJoin('/p', model.get('uuid'), '/')
|
||||
|
Loading…
Reference in New Issue
Block a user