Updated email faqs in portal to show sender email address

refs https://github.com/TryGhost/Team/issues/2348

- updates email faqs to show the sender email from newsletter data
This commit is contained in:
Rishabh 2022-12-12 11:40:42 +05:30 committed by Rishabh Garg
parent 14bdb58694
commit ce45571dc0
4 changed files with 22 additions and 7 deletions

View File

@ -18,6 +18,7 @@ Object {
"description": null,
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"name": "Default Newsletter",
"sender_email": null,
"slug": "default-newsletter",
"sort_order": 0,
"subscribe_on_signup": true,
@ -30,6 +31,7 @@ Object {
"description": null,
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"name": "Daily newsletter",
"sender_email": "jamie@example.com",
"slug": "daily-newsletter",
"sort_order": 1,
"subscribe_on_signup": false,
@ -42,6 +44,7 @@ Object {
"description": null,
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"name": "Weekly newsletter",
"sender_email": "jamie@example.com",
"slug": "weekly-newsletter",
"sort_order": 2,
"subscribe_on_signup": true,
@ -57,7 +60,7 @@ exports[`Newsletters Content API Can request only active newsletters 2: [headers
Object {
"access-control-allow-origin": "*",
"cache-control": "public, max-age=0",
"content-length": "1000",
"content-length": "1090",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Accept-Version, Accept-Encoding",
@ -83,6 +86,7 @@ Object {
"description": null,
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"name": "Default Newsletter",
"sender_email": null,
"slug": "default-newsletter",
"sort_order": 0,
"subscribe_on_signup": true,
@ -95,6 +99,7 @@ Object {
"description": null,
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"name": "Daily newsletter",
"sender_email": "jamie@example.com",
"slug": "daily-newsletter",
"sort_order": 1,
"subscribe_on_signup": false,
@ -107,6 +112,7 @@ Object {
"description": null,
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
"name": "Weekly newsletter",
"sender_email": "jamie@example.com",
"slug": "weekly-newsletter",
"sort_order": 2,
"subscribe_on_signup": true,
@ -122,7 +128,7 @@ exports[`Newsletters Content API Cannot override filters to fetch archived newsl
Object {
"access-control-allow-origin": "*",
"cache-control": "public, max-age=0",
"content-length": "1000",
"content-length": "1090",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Accept-Version, Accept-Encoding",

View File

@ -239,6 +239,7 @@ describe('Unit: utils/serializers/output/mappers', function () {
name: newsletter.name,
description: newsletter.description,
slug: newsletter.slug,
sender_email: newsletter.sender_email,
subscribe_on_signup: newsletter.subscribe_on_signup,
visibility: newsletter.visibility,
sort_order: newsletter.sort_order,

View File

@ -2,14 +2,14 @@ import AppContext from 'AppContext';
import {useContext} from 'react';
import BackButton from 'components/common/BackButton';
import CloseButton from 'components/common/CloseButton';
import {getSupportAddress} from 'utils/helpers';
import {getDefaultNewsletterSender, getSupportAddress} from 'utils/helpers';
export default function EmailReceivingPage() {
const {brandColor, onAction, site, lastPage, member} = useContext(AppContext);
const supportAddressEmail = getSupportAddress({site});
const supportAddress = `mailto:${supportAddressEmail}`;
const defaultNewsletterSenderEmail = getDefaultNewsletterSender({site});
return (
<div className="gh-email-receiving-faq">
<header className='gh-portal-detail-header'>
@ -38,15 +38,15 @@ export default function EmailReceivingPage() {
<h4>Create a new contact</h4>
<p>In your email client add <strong className="ul">%newsletter@fromaddress.com%</strong> to your contacts list. This signals to your mail provider that emails sent from this address should be trusted.</p>
<p>In your email client add <strong className="ul">{defaultNewsletterSenderEmail}</strong> to your contacts list. This signals to your mail provider that emails sent from this address should be trusted.</p>
<h4>Send an email and say hi!</h4>
<p>Send an email to <strong className="ul">%newsletter@fromaddress.com%</strong> and say hello. This can also help signal to your mail provider that emails to-and-from this address should be trusted.</p>
<p>Send an email to <strong className="ul">{defaultNewsletterSenderEmail}</strong> and say hello. This can also help signal to your mail provider that emails to-and-from this address should be trusted.</p>
<h4>Check with your mail provider</h4>
<p>If you have a corporate or government email account, reach out to your IT department and ask them to allow emails to be received from <strong className="ul">%newsletter@fromaddress.com%</strong></p>
<p>If you have a corporate or government email account, reach out to your IT department and ask them to allow emails to be received from <strong className="ul">{defaultNewsletterSenderEmail}</strong></p>
<h4>Get in touch for help</h4>

View File

@ -692,6 +692,14 @@ export const getSupportAddress = ({site}) => {
return supportAddress || '';
};
export const getDefaultNewsletterSender = ({site}) => {
const newsletters = getSiteNewsletters({site});
const defaultNewsletter = newsletters?.[0];
if (defaultNewsletter) {
return defaultNewsletter.sender_email || `noreply@${getSiteDomain({site})}`;
}
};
export const getSiteDomain = ({site}) => {
try {
return ((new URL(site.url)).origin).replace(/^http(s?):\/\//, '').replace(/\/$/, '');