mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
🐛 Fixed meta attributes calculation on post preview
closes https://github.com/TryGhost/Ghost/issues/12247 - Internal preview controller was lacking "mapping" call to post object which handled not only missing meta attribute information but lots of other mappings (e.g. users, tags, etc.) - Have added a regression test to catch issues like this in the future
This commit is contained in:
parent
b34f2e86fb
commit
39e403d176
4 changed files with 13 additions and 2 deletions
|
@ -1,7 +1,9 @@
|
||||||
|
const mapper = require('./utils/mapper');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
all(model, apiConfig, frame) {
|
all(model, apiConfig, frame) {
|
||||||
frame.response = {
|
frame.response = {
|
||||||
preview: [model.toJSON(frame.options)]
|
preview: [mapper.mapPost(model, frame)]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
const mapper = require('./utils/mapper');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
all(model, apiConfig, frame) {
|
all(model, apiConfig, frame) {
|
||||||
frame.response = {
|
frame.response = {
|
||||||
preview: [model.toJSON(frame.options)]
|
preview: [mapper.mapPost(model, frame)]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -253,6 +253,8 @@ describe('Frontend Routing', function () {
|
||||||
should.exist(res.headers.date);
|
should.exist(res.headers.date);
|
||||||
|
|
||||||
$('title').text().should.equal('Not finished yet');
|
$('title').text().should.equal('Not finished yet');
|
||||||
|
$('meta[name="description"]').attr('content').should.equal('meta description for draft post');
|
||||||
|
|
||||||
// @TODO: use theme from fixtures and don't rely on content/themes/casper
|
// @TODO: use theme from fixtures and don't rely on content/themes/casper
|
||||||
// $('.content .post').length.should.equal(1);
|
// $('.content .post').length.should.equal(1);
|
||||||
// $('.poweredby').text().should.equal('Proudly published with Ghost');
|
// $('.poweredby').text().should.equal('Proudly published with Ghost');
|
||||||
|
|
|
@ -809,6 +809,11 @@ DataGenerator.forKnex = (function () {
|
||||||
id: ObjectId.generate(),
|
id: ObjectId.generate(),
|
||||||
post_id: DataGenerator.Content.posts[2].id,
|
post_id: DataGenerator.Content.posts[2].id,
|
||||||
meta_description: 'test stuff'
|
meta_description: 'test stuff'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: ObjectId.generate(),
|
||||||
|
post_id: DataGenerator.Content.posts[3].id,
|
||||||
|
meta_description: 'meta description for draft post'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue