Skip to content

Commit

Permalink
Fixed custom subject in email preview
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhgrg committed Nov 6, 2019
1 parent 77daa77 commit 6357d0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/server/api/canary/email-preview.js
Expand Up @@ -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) => {
Expand Down
3 changes: 3 additions & 0 deletions core/server/services/mega/post-email-serializer.js
Expand Up @@ -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()})),
Expand Down

0 comments on commit 6357d0c

Please sign in to comment.