Added authors to email preview template

This commit is contained in:
Rish 2019-11-06 18:03:28 +07:00
parent c64be968c1
commit 4db260f17e
3 changed files with 5 additions and 4 deletions

View File

@ -20,7 +20,7 @@ module.exports = {
],
permissions: true,
query(frame) {
const options = Object.assign(frame.options, {formats: 'html,plaintext'});
const options = Object.assign(frame.options, {formats: 'html,plaintext', withRelated: ['authors']});
return models.Post.findOne(frame.data, options)
.then((model) => {
if (!model) {

View File

@ -12,6 +12,7 @@ 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(',');
return {
subject: post.email_subject || post.title,
html: juice(template({post, site: getSite()})),

View File

@ -1,6 +1,6 @@
/* eslint indent: warn, no-irregular-whitespace: warn */
module.exports = ({post, site}) => {
const currentYear = new Date();
const date = new Date();
return `<!doctype html>
<html>
@ -805,7 +805,7 @@ figure blockquote p {
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="post-meta">
By Authors
By ${post.authors}
${post.published_at}
<a href="${post.url}" class="view-online-link">View online </a>
</td>
@ -840,7 +840,7 @@ figure blockquote p {
<td class="wrapper">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="footer">${site.title} &copy; ${currentYear.getFullYear()}  <a href="%recipient.unsubscribe_url%">Unsubscribe</a></td>
<td class="footer">${site.title} &copy; ${date.getFullYear()}  <a href="%recipient.unsubscribe_url%">Unsubscribe</a></td>
</tr>
</table>
</td>