mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Handled missing support address on site
- the handling for non-existent support address for a site was missing, causing portal to not load in scenarios where support address is shown in UI
This commit is contained in:
parent
16d76feb3b
commit
4981a72c9f
2 changed files with 11 additions and 1 deletions
|
@ -589,7 +589,7 @@ export const getMemberName = ({member}) => {
|
|||
export const getSupportAddress = ({site}) => {
|
||||
const {members_support_address: supportAddress} = site || {};
|
||||
|
||||
if (supportAddress.indexOf('@') < 0) {
|
||||
if (supportAddress?.indexOf('@') < 0) {
|
||||
const siteDomain = getSiteDomain({site});
|
||||
const updatedDomain = siteDomain?.replace(/^(www)\.(?=[^/]*\..{2,5})/, '') || '';
|
||||
return `${supportAddress}@${updatedDomain}`;
|
||||
|
|
|
@ -223,6 +223,16 @@ describe('Helpers - ', () => {
|
|||
|
||||
expect(supportAddress).toBe('noreply@example.com');
|
||||
});
|
||||
|
||||
test('returns empty string for missing support address', () => {
|
||||
let site = {
|
||||
members_support_address: null,
|
||||
url: 'https://www.example.com'
|
||||
};
|
||||
const supportAddress = getSupportAddress({site});
|
||||
|
||||
expect(supportAddress).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getPriceIdFromPageQuery - ', () => {
|
||||
|
|
Loading…
Add table
Reference in a new issue