mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 21:40:39 +03:00
Fixed custom subject in email preview
This commit is contained in:
parent
77daa77e04
commit
6357d0c79b
@ -20,7 +20,7 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
permissions: true,
|
permissions: true,
|
||||||
query(frame) {
|
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'});
|
const data = Object.assign(frame.data, {status: 'all'});
|
||||||
return models.Post.findOne(data, options)
|
return models.Post.findOne(data, options)
|
||||||
.then((model) => {
|
.then((model) => {
|
||||||
|
@ -13,6 +13,9 @@ const getSite = () => {
|
|||||||
const serialize = (post) => {
|
const serialize = (post) => {
|
||||||
post.published_at = post.published_at ? moment(post.published_at).format('DD MMM YYYY') : moment().format('DD MMM YYYY');
|
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(',');
|
post.authors = post.authors && post.authors.map(author => author.name).join(',');
|
||||||
|
if (post.posts_meta) {
|
||||||
|
post.email_subject = post.posts_meta.email_subject;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
subject: post.email_subject || post.title,
|
subject: post.email_subject || post.title,
|
||||||
html: juice(template({post, site: getSite()})),
|
html: juice(template({post, site: getSite()})),
|
||||||
|
Loading…
Reference in New Issue
Block a user