mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Fixed sender name and email in email preview link
refs https://github.com/TryGhost/Team/issues/1568 Sender name and email of newsletter was not used in the preview.
This commit is contained in:
parent
2a5fe4b7db
commit
d25b94fb77
2 changed files with 17 additions and 2 deletions
|
@ -20,7 +20,7 @@
|
|||
<div class="gh-pe-mobile-screen">
|
||||
<div class="gh-pe-emailclient-sender">
|
||||
<p>
|
||||
<span class="strong">{{this.config.blogTitle}}</span> <{{this.settings.membersFromAddress}}>
|
||||
<span class="strong">{{or this.newsletter.senderName this.settings.title}}</span> <{{full-email-address (or this.newsletter.senderEmail "noreply")}}>
|
||||
</p>
|
||||
<p><span class="dark">To:</span> Jamie Larson <jamie@example.com></p>
|
||||
</div>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<div class="gh-pe-emailclient-mockup">
|
||||
<div class="gh-pe-emailclient-sender">
|
||||
<p>
|
||||
<span class="strong">{{this.config.blogTitle}}</span> <{{this.settings.membersFromAddress}}>
|
||||
<span class="strong">{{or this.newsletter.senderName this.settings.title}}</span> <{{full-email-address (or this.newsletter.senderEmail "noreply")}}>
|
||||
</p>
|
||||
<p><span class="dark">To:</span> Jamie Larson <jamie@example.com></p>
|
||||
</div>
|
||||
|
|
|
@ -20,6 +20,7 @@ export default class EmailPreviewModal extends Component {
|
|||
@service config;
|
||||
@service ghostPaths;
|
||||
@service settings;
|
||||
@service store;
|
||||
|
||||
static modalOptions = {
|
||||
className: 'fullscreen-modal-full-overlay fullscreen-modal-email-preview'
|
||||
|
@ -27,6 +28,7 @@ export default class EmailPreviewModal extends Component {
|
|||
|
||||
@tracked tab = 'desktop';
|
||||
@tracked subject = null;
|
||||
@tracked newsletter = null;
|
||||
|
||||
// cached to avoid re-fetching when changing tabs
|
||||
html = null;
|
||||
|
@ -52,6 +54,19 @@ export default class EmailPreviewModal extends Component {
|
|||
async _fetchEmailData() {
|
||||
let {html, subject} = this;
|
||||
|
||||
// Fetch newsletter
|
||||
if (!this.newsletter && this.args.data.newsletterId) {
|
||||
const newsletters = (await this.store.query('newsletter', {filter: 'status:active+id:' + this.args.data.newsletterId, limit: 1})).toArray();
|
||||
const defaultNewsletter = newsletters[0];
|
||||
this.newsletter = defaultNewsletter;
|
||||
}
|
||||
|
||||
if (!this.newsletter) {
|
||||
const newsletters = (await this.store.query('newsletter', {filter: 'status:active', limit: 1})).toArray();
|
||||
const defaultNewsletter = newsletters[0];
|
||||
this.newsletter = defaultNewsletter;
|
||||
}
|
||||
|
||||
if (html && subject) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue