diff --git a/ghost/core/core/server/services/staff/index.js b/ghost/core/core/server/services/staff/index.js index 2b57d20de6..56c08cab2d 100644 --- a/ghost/core/core/server/services/staff/index.js +++ b/ghost/core/core/server/services/staff/index.js @@ -17,6 +17,7 @@ class StaffServiceWrapper { const mailer = new GhostMailer(); const settingsCache = require('../../../shared/settings-cache'); const urlUtils = require('../../../shared/url-utils'); + const {blogIcon} = require('../../../server/lib/image'); const settingsHelpers = require('../settings-helpers'); this.api = new StaffService({ @@ -26,6 +27,7 @@ class StaffServiceWrapper { settingsHelpers, settingsCache, urlUtils, + blogIcon, DomainEvents, memberAttributionService: memberAttribution.service, labs diff --git a/ghost/staff-service/lib/StaffService.js b/ghost/staff-service/lib/StaffService.js index 02d4e1b4dd..ed48a4a860 100644 --- a/ghost/staff-service/lib/StaffService.js +++ b/ghost/staff-service/lib/StaffService.js @@ -4,7 +4,7 @@ const {MilestoneCreatedEvent} = require('@tryghost/milestones'); // @NOTE: 'StaffService' is a vague name that does not describe what it's actually doing. // Possibly, "StaffNotificationService" or "StaffEventNotificationService" would be a more accurate name class StaffService { - constructor({logging, models, mailer, settingsCache, settingsHelpers, urlUtils, DomainEvents, labs, memberAttributionService}) { + constructor({logging, models, mailer, settingsCache, settingsHelpers, urlUtils, blogIcon, DomainEvents, labs, memberAttributionService}) { this.logging = logging; this.labs = labs; /** @private */ @@ -22,6 +22,7 @@ class StaffService { settingsHelpers, settingsCache, urlUtils, + blogIcon, labs }); } diff --git a/ghost/staff-service/lib/StaffServiceEmails.js b/ghost/staff-service/lib/StaffServiceEmails.js index b107af3ee1..fa15117087 100644 --- a/ghost/staff-service/lib/StaffServiceEmails.js +++ b/ghost/staff-service/lib/StaffServiceEmails.js @@ -5,12 +5,13 @@ const glob = require('glob'); const {EmailAddressParser} = require('@tryghost/email-addresses'); class StaffServiceEmails { - constructor({logging, models, mailer, settingsHelpers, settingsCache, urlUtils, labs}) { + constructor({logging, models, mailer, settingsHelpers, settingsCache, blogIcon, urlUtils, labs}) { this.logging = logging; this.models = models; this.mailer = mailer; this.settingsHelpers = settingsHelpers; this.settingsCache = settingsCache; + this.blogIcon = blogIcon; this.urlUtils = urlUtils; this.labs = labs; @@ -44,6 +45,7 @@ class StaffServiceEmails { attributionUrl: attribution?.url || '', referrerSource: attribution?.referrerSource, siteTitle: this.settingsCache.get('title'), + siteIconUrl: this.blogIcon.getIconUrl(true), siteUrl: this.urlUtils.getSiteUrl(), siteDomain: this.siteDomain, accentColor: this.settingsCache.get('accent_color'), @@ -103,6 +105,7 @@ class StaffServiceEmails { offerData, subscriptionData, siteTitle: this.settingsCache.get('title'), + siteIconUrl: this.blogIcon.getIconUrl(true), siteUrl: this.urlUtils.getSiteUrl(), siteDomain: this.siteDomain, accentColor: this.settingsCache.get('accent_color'), @@ -153,6 +156,7 @@ class StaffServiceEmails { tierData, subscriptionData, siteTitle: this.settingsCache.get('title'), + siteIconUrl: this.blogIcon.getIconUrl(true), siteUrl: this.urlUtils.getSiteUrl(), siteDomain: this.siteDomain, accentColor: this.settingsCache.get('accent_color'), @@ -182,6 +186,7 @@ class StaffServiceEmails { return { siteTitle: this.settingsCache.get('title'), + siteIconUrl: this.blogIcon.getIconUrl(true), siteUrl: this.urlUtils.getSiteUrl(), siteDomain: this.siteDomain, accentColor: this.settingsCache.get('accent_color'), @@ -282,6 +287,7 @@ class StaffServiceEmails { const templateData = { siteTitle: this.settingsCache.get('title'), siteUrl: this.urlUtils.getSiteUrl(), + siteIconUrl: this.blogIcon.getIconUrl(true), siteDomain: this.siteDomain, fromEmail: this.fromEmailAddress, toEmail: to, diff --git a/ghost/staff-service/lib/email-templates/donation.hbs b/ghost/staff-service/lib/email-templates/donation.hbs index 88b1e07a8f..35a33fc398 100644 --- a/ghost/staff-service/lib/email-templates/donation.hbs +++ b/ghost/staff-service/lib/email-templates/donation.hbs @@ -21,21 +21,33 @@ + {{#if siteIconUrl}} + + + + {{/if}} @@ -43,13 +55,13 @@ - - diff --git a/ghost/staff-service/test/staff-service.test.js b/ghost/staff-service/test/staff-service.test.js index bf8b03d0b5..920ee9d37a 100644 --- a/ghost/staff-service/test/staff-service.test.js +++ b/ghost/staff-service/test/staff-service.test.js @@ -149,6 +149,12 @@ describe('StaffService', function () { } }; + const blogIcon = { + getIconUrl: () => { + return 'https://ghost.example/siteicon.png'; + } + }; + const settingsHelpers = { getDefaultEmailDomain: () => { return 'ghost.example'; @@ -184,6 +190,7 @@ describe('StaffService', function () { }, settingsCache, urlUtils, + blogIcon, settingsHelpers, labs }); @@ -220,6 +227,7 @@ describe('StaffService', function () { DomainEvents, settingsCache, urlUtils, + blogIcon, settingsHelpers }); service.subscribeEvents(); @@ -339,6 +347,7 @@ describe('StaffService', function () { }, settingsCache, urlUtils, + blogIcon, settingsHelpers, labs: { isSet: () => {
{{siteTitle}}
-

Cha-ching! 💰 You received {{donation.amount}} from {{donation.name}}.

- +

Cha-ching! You received a {{donation.amount}} tip from {{donation.name}}.

+
- - - + + + + + +
-

Type:

-

One-time payment

-

From:

-

{{#if memberData}}{{donation.name}} ({{donation.email}}){{else}}{{donation.name}} ({{donation.email}}){{/if}}

-

Amount received:

-

{{donation.amount}}

-
+

From:

+ +

Amount received:

+

{{donation.amount}}

+
+ {{#if memberData}} + View member + {{else}} + View dashboard + {{/if}} +
-

This message was sent from {{siteDomain}} to {{toEmail}}

+
+

This message was sent from {{siteDomain}} to {{toEmail}}

-

Don’t want to receive these emails? Manage your preferences here.

+
+

Don’t want to receive these emails? Manage your preferences here.