Fixed custom subject in email preview
This commit is contained in:
parent
77daa77e04
commit
6357d0c79b
@ -20,7 +20,7 @@ module.exports = {
|
||||
],
|
||||
permissions: true,
|
||||
query(frame) {
|
||||
const options = Object.assign(frame.options, {formats: 'html,plaintext', withRelated: ['authors']});
|
||||
const options = Object.assign(frame.options, {formats: 'html,plaintext', withRelated: ['authors', 'posts_meta']});
|
||||
const data = Object.assign(frame.data, {status: 'all'});
|
||||
return models.Post.findOne(data, options)
|
||||
.then((model) => {
|
||||
|
@ -13,6 +13,9 @@ const getSite = () => {
|
||||
const serialize = (post) => {
|
||||
post.published_at = post.published_at ? moment(post.published_at).format('DD MMM YYYY') : moment().format('DD MMM YYYY');
|
||||
post.authors = post.authors && post.authors.map(author => author.name).join(',');
|
||||
if (post.posts_meta) {
|
||||
post.email_subject = post.posts_meta.email_subject;
|
||||
}
|
||||
return {
|
||||
subject: post.email_subject || post.title,
|
||||
html: juice(template({post, site: getSite()})),
|
||||
|
Loading…
Reference in New Issue
Block a user