mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 11:54:33 +03:00
Added plaintext field to email preview response
This commit is contained in:
parent
d1812281f7
commit
5d76ceef8b
@ -19,7 +19,8 @@ module.exports = {
|
||||
],
|
||||
permissions: true,
|
||||
query(frame) {
|
||||
return models.Post.findOne(frame.data, frame.options)
|
||||
const options = Object.assign(frame.options, {formats: 'html,plaintext'});
|
||||
return models.Post.findOne(frame.data, options)
|
||||
.then((model) => {
|
||||
if (!model) {
|
||||
throw new common.errors.NotFoundError({
|
||||
@ -27,7 +28,7 @@ module.exports = {
|
||||
});
|
||||
}
|
||||
|
||||
const post = model.toJSON();
|
||||
const post = model.toJSON(options);
|
||||
|
||||
return mega.postEmailSerializer.serialize(post);
|
||||
});
|
||||
|
@ -12,7 +12,8 @@ const getSite = () => {
|
||||
const serialize = (post) => {
|
||||
return {
|
||||
subject: post.email_subject || post.title,
|
||||
html: juice(template({post, site: getSite()}))
|
||||
html: juice(template({post, site: getSite()})),
|
||||
plaintext: post.plaintext
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user