diff --git a/ghost/admin/app/components/modal-tier.hbs b/ghost/admin/app/components/modal-tier.hbs index 154df41069..5b329a0397 100644 --- a/ghost/admin/app/components/modal-tier.hbs +++ b/ghost/admin/app/components/modal-tier.hbs @@ -107,7 +107,7 @@

{{this.stripePlanError}}

{{/if}} - +
@@ -122,7 +122,7 @@ name="free-trial" {{on "click" this.setFreeTrialEnabled}} /> - +
@@ -145,7 +145,7 @@ {{/if}}
- + { // Go to settings page @@ -34,6 +34,12 @@ test.describe('Site Settings', () => { test.describe('Subscription Access', () => { test('Invite only', async ({page}) => { await page.goto('/ghost'); + await createTier(page, { + name: 'Free tier trial', + monthlyPrice: 100, + yearlyPrice: 1000, + trialDays: 5 + }, true); await changeSubscriptionAccess(page, 'invite'); @@ -45,6 +51,9 @@ test.describe('Site Settings', () => { // Check sign up is disabled and a message is shown await expect(portalFrame.locator('.gh-portal-invite-only-notification')).toHaveText('This site is invite-only, contact the owner for access.'); + // Check free trial message is not shown for invite only + await expect(portalFrame.locator('.gh-portal-free-trial-notification')).not.toBeVisible(); + // Check portal script loaded (just a negative test for the following test to test the test) await checkPortalScriptLoaded(page, true); }); diff --git a/ghost/core/test/e2e-browser/utils/e2e-browser-utils.js b/ghost/core/test/e2e-browser/utils/e2e-browser-utils.js index 6b57b03836..3a943da6e9 100644 --- a/ghost/core/test/e2e-browser/utils/e2e-browser-utils.js +++ b/ghost/core/test/e2e-browser/utils/e2e-browser-utils.js @@ -175,8 +175,9 @@ const impersonateMember = async (page) => { * @param {string} tier.name * @param {number} tier.monthlyPrice * @param {number} tier.yearlyPrice + * @param {number} [tier.trialDays] */ -const createTier = async (page, {name, monthlyPrice, yearlyPrice}, enableInPortal = true) => { +const createTier = async (page, {name, monthlyPrice, yearlyPrice, trialDays}, enableInPortal = true) => { // Navigate to the member settings await page.locator('.gh-nav a[href="#/settings/"]').click(); await page.locator('.gh-setting-group').filter({hasText: 'Membership'}).click(); @@ -201,6 +202,10 @@ const createTier = async (page, {name, monthlyPrice, yearlyPrice}, enableInPorta await modal.locator('input#name').first().fill(name); await modal.locator('#monthlyPrice').fill(`${monthlyPrice}`); await modal.locator('#yearlyPrice').fill(`${yearlyPrice}`); + if (trialDays) { + await modal.locator('[data-test-toggle="free-trial"]').click(); + await modal.locator('#trial').fill(`${trialDays}`); + } await modal.getByRole('button', {name: 'Add tier'}).click(); await page.waitForSelector('.modal-content input#name', {state: 'detached'}); diff --git a/ghost/portal/src/components/pages/SignupPage.js b/ghost/portal/src/components/pages/SignupPage.js index 0f8bc7ea94..e5a98b9c4e 100644 --- a/ghost/portal/src/components/pages/SignupPage.js +++ b/ghost/portal/src/components/pages/SignupPage.js @@ -457,7 +457,7 @@ class SignupPage extends React.Component { renderFreeTrialMessage() { const {site} = this.context; - if (hasFreeTrialTier({site})) { + if (hasFreeTrialTier({site}) && !isInviteOnlySite({site})) { return (

After a free trial ends, you will be charged the regular price for the tier you’ve chosen. You can always cancel before then.

);