mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 05:14:12 +03: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
@ -1,7 +1,9 @@
|
||||
const mapper = require('./utils/mapper');
|
||||
|
||||
module.exports = {
|
||||
all(model, apiConfig, frame) {
|
||||
frame.response = {
|
||||
preview: [model.toJSON(frame.options)]
|
||||
preview: [mapper.mapPost(model, frame)]
|
||||
};
|
||||
}
|
||||
};
|
||||
|
@ -1,7 +1,9 @@
|
||||
const mapper = require('./utils/mapper');
|
||||
|
||||
module.exports = {
|
||||
all(model, apiConfig, frame) {
|
||||
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);
|
||||
|
||||
$('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
|
||||
// $('.content .post').length.should.equal(1);
|
||||
// $('.poweredby').text().should.equal('Proudly published with Ghost');
|
||||
|
@ -809,6 +809,11 @@ DataGenerator.forKnex = (function () {
|
||||
id: ObjectId.generate(),
|
||||
post_id: DataGenerator.Content.posts[2].id,
|
||||
meta_description: 'test stuff'
|
||||
},
|
||||
{
|
||||
id: ObjectId.generate(),
|
||||
post_id: DataGenerator.Content.posts[3].id,
|
||||
meta_description: 'meta description for draft post'
|
||||
}
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user