From 6d53e40bd94a3993a44bf0b0df9a021050dcd120 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Fri, 19 Aug 2022 10:41:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20broken=20email=20prefs?= =?UTF-8?q?=20link=20in=20comment=20emails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes: https://github.com/TryGhost/Ghost/issues/15251 - getAdminUrl is a config helper that returns the direct value from config - change to using urlJoin and urlFor helpers to generate the correct URL - not entirely happy with this fix as there's no test, but I've verified it locally --- ghost/core/core/server/services/comments/emails.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ghost/core/core/server/services/comments/emails.js b/ghost/core/core/server/services/comments/emails.js index ca739dbafa..54d9bed13a 100644 --- a/ghost/core/core/server/services/comments/emails.js +++ b/ghost/core/core/server/services/comments/emails.js @@ -45,7 +45,7 @@ class CommentsServiceEmails { accentColor: this.settingsCache.get('accent_color'), fromEmail: this.notificationFromAddress, toEmail: to, - staffUrl: `${this.urlUtils.getAdminUrl()}ghost/#/settings/staff/${author.get('slug')}` + staffUrl: this.urlUtils.urlJoin(this.urlUtils.urlFor('admin', true), '#', `/settings/staff/${author.get('slug')}`) }; const {html, text} = await this.renderEmailTemplate('new-comment', templateData); @@ -132,7 +132,7 @@ class CommentsServiceEmails { commentHtml: comment.get('html'), commentText: htmlToPlaintext.comment(comment.get('html')), commentDate: moment(comment.get('created_at')).tz(this.settingsCache.get('timezone')).format('D MMM YYYY'), - + reporterName: reporter.name, reporterEmail: reporter.email, reporter: reporter.name ? `${reporter.name} (${reporter.email})` : reporter.email, @@ -144,7 +144,7 @@ class CommentsServiceEmails { accentColor: this.settingsCache.get('accent_color'), fromEmail: this.notificationFromAddress, toEmail: to, - staffUrl: `${this.urlUtils.getAdminUrl()}ghost/#/settings/staff/${owner.get('slug')}` + staffUrl: this.urlUtils.urlJoin(this.urlUtils.urlFor('admin', true), '#', `/settings/staff/${owner.get('slug')}`) }; const {html, text} = await this.renderEmailTemplate('report', templateData);