From 6d1de1b912698c3233744c8afc05bc0839dbd138 Mon Sep 17 00:00:00 2001 From: Rish Date: Thu, 14 Nov 2019 10:45:05 +0530 Subject: [PATCH] Fixed post not showing authors in email no issue --- core/server/api/canary/email-preview.js | 2 +- core/server/services/mega/mega.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/core/server/api/canary/email-preview.js b/core/server/api/canary/email-preview.js index e3bf694d80..be65c7fc67 100644 --- a/core/server/api/canary/email-preview.js +++ b/core/server/api/canary/email-preview.js @@ -52,7 +52,7 @@ module.exports = { permissions: true, async query(frame) { const options = Object.assign(frame.options, {status: 'all'}); - let model = await models.Post.findOne(options); + let model = await models.Post.findOne(options, {withRelated: ['authors']}); if (!model) { throw new common.errors.NotFoundError({ message: common.i18n.t('errors.api.posts.postNotFound') diff --git a/core/server/services/mega/mega.js b/core/server/services/mega/mega.js index fbed56b6c3..a119509ed4 100644 --- a/core/server/services/mega/mega.js +++ b/core/server/services/mega/mega.js @@ -166,8 +166,7 @@ async function listener(emailModel, options) { if (options && options.importing) { return; } - - const postModel = await models.Post.findOne({id: emailModel.get('post_id')}); + const postModel = await models.Post.findOne({id: emailModel.get('post_id')}, {withRelated: ['authors']}); const post = await serialize(postModel);