mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
🐛 Fixed blank email previews when opening from member activity feeds (#16207)
refs https://github.com/TryGhost/Team/issues/2506 `email` objects no longer contain a `html` field and the fallback logic in the email preview modal was failing resulting in a 404 from trying to fetch an email preview using the email id rather than a post id. - added quick-fix to the preview modal logic to use `data.post_id || data.id` for generating the preview URL (previous logic never expected to reach the fallback when working with an email record)
This commit is contained in:
parent
4f889586ad
commit
3c695064bd
1 changed files with 3 additions and 2 deletions
|
@ -79,9 +79,10 @@ export default class EmailPreviewModal extends Component {
|
|||
} else if (this.args.data.email) {
|
||||
html = this.args.data.email.html;
|
||||
subject = this.args.data.email.subject;
|
||||
// data is a post? try fetching email preview
|
||||
// data is a post or has no html, try fetching email preview
|
||||
} else {
|
||||
let url = this.ghostPaths.url.api('/email_previews/posts', this.args.data.id);
|
||||
const id = this.args.data.post_id || this.args.data.id;
|
||||
let url = this.ghostPaths.url.api('/email_previews/posts', id);
|
||||
let response = await this.ajax.request(url);
|
||||
let [emailPreview] = response.email_previews;
|
||||
html = emailPreview.html;
|
||||
|
|
Loading…
Add table
Reference in a new issue