From 524fe6ee1917a5518c37f95b8c448cc3cc04559b Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 20 Jun 2024 11:01:35 +0100 Subject: [PATCH] Cleaned up onboardingChecklist GA labs flag no issue - removed labs flag - removed labs flag conditionals - removed code related to old setup/done screen - fixed tests that weren't correctly running against the GA flag code --- .../settings/advanced/labs/AlphaFeatures.tsx | 4 -- .../editor/modals/publish-flow/complete.hbs | 13 +--- ghost/admin/app/controllers/setup/done.js | 72 ------------------- ghost/admin/app/routes/setup/done.js | 17 +---- ghost/admin/app/routes/setup/index.js | 5 +- ghost/admin/app/services/feature.js | 1 - ghost/admin/app/services/onboarding.js | 4 +- ghost/admin/app/templates/setup/done.hbs | 46 ------------ .../acceptance/editor/publish-flow-test.js | 2 +- .../admin/tests/acceptance/onboarding-test.js | 2 - ghost/admin/tests/acceptance/setup-test.js | 6 +- ghost/core/core/shared/labs.js | 1 - .../admin/__snapshots__/settings.test.js.snap | 2 +- 13 files changed, 13 insertions(+), 162 deletions(-) delete mode 100644 ghost/admin/app/controllers/setup/done.js delete mode 100644 ghost/admin/app/templates/setup/done.hbs diff --git a/apps/admin-x-settings/src/components/settings/advanced/labs/AlphaFeatures.tsx b/apps/admin-x-settings/src/components/settings/advanced/labs/AlphaFeatures.tsx index ede57e0236..1d6c8e2f09 100644 --- a/apps/admin-x-settings/src/components/settings/advanced/labs/AlphaFeatures.tsx +++ b/apps/admin-x-settings/src/components/settings/advanced/labs/AlphaFeatures.tsx @@ -51,10 +51,6 @@ const features = [{ title: 'AdminX Demo', description: 'Adds a navigation link to the AdminX demo app', flag: 'adminXDemo' -},{ - title: 'Onboarding checklist', - description: 'Onboarding checklist that helps new customers get started', - flag: 'onboardingChecklist' },{ title: 'NestJS Playground', description: 'Wires up the Ghost NestJS App to the Admin API', diff --git a/ghost/admin/app/components/editor/modals/publish-flow/complete.hbs b/ghost/admin/app/components/editor/modals/publish-flow/complete.hbs index 83c6e3116a..505cd3bd8e 100644 --- a/ghost/admin/app/components/editor/modals/publish-flow/complete.hbs +++ b/ghost/admin/app/components/editor/modals/publish-flow/complete.hbs @@ -97,18 +97,7 @@

{{else}}

- {{#if (feature "onboardingChecklist")}} - Back to dashboard - {{else}} - - {{/if}} + Back to dashboard

{{/if}} {{/if}} diff --git a/ghost/admin/app/controllers/setup/done.js b/ghost/admin/app/controllers/setup/done.js deleted file mode 100644 index bd2480fc79..0000000000 --- a/ghost/admin/app/controllers/setup/done.js +++ /dev/null @@ -1,72 +0,0 @@ -import Controller from '@ember/controller'; -import {isEmpty} from '@ember/utils'; -import {inject as service} from '@ember/service'; -import {task} from 'ember-concurrency'; -import {tracked} from '@glimmer/tracking'; - -const THEME_PROPERTIES = { - casper: ['description', 'color', 'coverImage'], - source: ['description', 'color', 'coverImage'], - edition: ['description', 'color', 'coverImage'], - dawn: ['description', 'color', 'icon'], - dope: ['description', 'color', 'logo'], - bulletin: ['description', 'color', 'logo'], - alto: ['description', 'color', 'logo'], - journal: ['description', 'color', 'logo'], - wave: ['description', 'color', 'logo', 'coverImage'], - edge: ['description', 'color', 'logo'], - ease: ['description', 'color', 'logo', 'coverImage'], - ruby: ['description', 'color', 'logo', 'coverImage'], - london: ['description', 'color', 'logo'], - digest: ['description', 'color', 'logo'] -}; - -export default class SetupFinishingTouchesController extends Controller { - @service modals; - @service router; - @service settings; - @service store; - @service themeManagement; - - @tracked descriptionVisible; - @tracked colorVisible; - @tracked logoVisible; - @tracked iconVisible; - @tracked coverImageVisible; - - themes = null; - - // Default properties to display - themeProperties = ['description', 'color', 'coverImage']; - - constructor() { - super(...arguments); - this.initThemeProperties.perform(); - } - - @task({drop: true}) - *initThemeProperties() { - this.themes = yield this.store.peekAll('theme'); - if (isEmpty(this.themes)) { - this.themes = yield this.store.findAll('theme'); - } - - const activeTheme = this.themes.findBy('active', true); - - if (activeTheme && THEME_PROPERTIES[activeTheme.name]) { - this.themeProperties = THEME_PROPERTIES[activeTheme.name]; - } - - this.descriptionVisible = this.themeProperties.includes('description'); - this.logoVisible = this.themeProperties.includes('logo'); - this.iconVisible = this.themeProperties.includes('icon'); - this.colorVisible = this.themeProperties.includes('color'); - this.coverImageVisible = this.themeProperties.includes('coverImage'); - } - - @task - *saveAndContinueTask() { - yield this.settings.save(); - this.router.transitionTo('home'); - } -} diff --git a/ghost/admin/app/routes/setup/done.js b/ghost/admin/app/routes/setup/done.js index ced49eb2f6..caca0c63e9 100644 --- a/ghost/admin/app/routes/setup/done.js +++ b/ghost/admin/app/routes/setup/done.js @@ -12,23 +12,10 @@ export default class SetupFinishingTouchesRoute extends AuthenticatedRoute { beforeModel() { super.beforeModel(...arguments); - if (!this.session.user.isOwnerOnly) { - return; - } - - if (this.feature.onboardingChecklist) { + if (this.session.user.isOwnerOnly) { this.onboarding.startChecklist(); - return this.router.transitionTo('dashboard'); } - } - model() { - this.themeManagement.setPreviewType('homepage'); - this.themeManagement.updatePreviewHtmlTask.perform(); - } - - deactivate() { - // rollback any unsaved setting changes when leaving - this.settings.rollbackAttributes(); + return this.router.transitionTo('dashboard'); } } diff --git a/ghost/admin/app/routes/setup/index.js b/ghost/admin/app/routes/setup/index.js index 827eb3d8af..9bc7190de9 100644 --- a/ghost/admin/app/routes/setup/index.js +++ b/ghost/admin/app/routes/setup/index.js @@ -1,8 +1,11 @@ import Route from '@ember/routing/route'; +import {inject as service} from '@ember/service'; export default class IndexRoute extends Route { + @service router; + beforeModel() { super.beforeModel(...arguments); - this.transitionTo('setup.one'); + this.router.transitionTo('setup.one'); } } diff --git a/ghost/admin/app/services/feature.js b/ghost/admin/app/services/feature.js index 717943baf7..b386cdd38a 100644 --- a/ghost/admin/app/services/feature.js +++ b/ghost/admin/app/services/feature.js @@ -80,7 +80,6 @@ export default class FeatureService extends Service { @feature('filterEmailDisabled') filterEmailDisabled; @feature('adminXDemo') adminXDemo; @feature('portalImprovements') portalImprovements; - @feature('onboardingChecklist') onboardingChecklist; @feature('ActivityPub') ActivityPub; @feature('internalLinking') internalLinking; @feature('editorExcerpt') editorExcerpt; diff --git a/ghost/admin/app/services/onboarding.js b/ghost/admin/app/services/onboarding.js index 56f8d868f8..d5a8d5ce3a 100644 --- a/ghost/admin/app/services/onboarding.js +++ b/ghost/admin/app/services/onboarding.js @@ -7,7 +7,6 @@ const EMPTY_SETTINGS = { }; export default class OnboardingService extends Service { - @service feature; @service session; ONBOARDING_STEPS = [ @@ -24,8 +23,7 @@ export default class OnboardingService extends Service { } get isChecklistShown() { - return this.feature.onboardingChecklist - && this.session.user.isOwnerOnly + return this.session.user.isOwnerOnly && this.checklistStarted && !this.checklistCompleted && !this.checklistDismissed; diff --git a/ghost/admin/app/templates/setup/done.hbs b/ghost/admin/app/templates/setup/done.hbs deleted file mode 100644 index 5dd1e9e805..0000000000 --- a/ghost/admin/app/templates/setup/done.hbs +++ /dev/null @@ -1,46 +0,0 @@ -
-
-
-
-
-
-
-
-

All done!

-

Your brand new publication is set up and ready to go.

-
-

What do you want to do first?

-
- - {{svg-jar "posts"}} -
Write your first post
-

Test out the editor and get a feel for creating content inside Ghost.

-
- - {{svg-jar "paint-palette"}} -
Customize your site
-

Review your settings and tweak the design to make your site just right.

-
- - {{svg-jar "members"}} -
Import members
-

Move your audience over to Ghost with our migration tools and guides.

-
- - {{svg-jar "house"}} -
Explore Ghost admin
-

View the dashboard, click around, and explore Ghost for yourself.

-
-
-
-
-
-
-
-
- - - -
-
-
\ No newline at end of file diff --git a/ghost/admin/tests/acceptance/editor/publish-flow-test.js b/ghost/admin/tests/acceptance/editor/publish-flow-test.js index 38bc4ee02a..255f6e92dd 100644 --- a/ghost/admin/tests/acceptance/editor/publish-flow-test.js +++ b/ghost/admin/tests/acceptance/editor/publish-flow-test.js @@ -125,7 +125,7 @@ describe('Acceptance: Publish flow', function () { expect(find('[data-test-button="publish-flow-preview"]'), 'preview button on complete step').to.not.exist; expect(find('[data-test-button="publish-flow-publish"]'), 'publish button on complete step').to.not.exist; - await click('[data-test-button="back-to-editor"]'); + await click('[data-test-button="close-publish-flow"]'); expect(find('[data-test-button="publish-flow"]'), 'publish button after publishing').to.not.exist; expect(find('[data-test-button="update-flow"]'), 'update button after publishing').to.exist; diff --git a/ghost/admin/tests/acceptance/onboarding-test.js b/ghost/admin/tests/acceptance/onboarding-test.js index a235ee4452..16c76925ed 100644 --- a/ghost/admin/tests/acceptance/onboarding-test.js +++ b/ghost/admin/tests/acceptance/onboarding-test.js @@ -1,7 +1,6 @@ import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support'; import {currentURL, find, visit} from '@ember/test-helpers'; import {describe, it} from 'mocha'; -import {enableLabsFlag} from '../helpers/labs-flag'; import {enableMembers} from '../helpers/members'; import {expect} from 'chai'; import {setupApplicationTest} from 'ember-mocha'; @@ -16,7 +15,6 @@ describe('Acceptance: Onboarding', function () { this.server.loadFixtures('settings'); this.server.loadFixtures('themes'); - enableLabsFlag(this.server, 'onboardingChecklist'); enableMembers(this.server); }); diff --git a/ghost/admin/tests/acceptance/setup-test.js b/ghost/admin/tests/acceptance/setup-test.js index 4857598448..1b2dabef44 100644 --- a/ghost/admin/tests/acceptance/setup-test.js +++ b/ghost/admin/tests/acceptance/setup-test.js @@ -84,7 +84,7 @@ describe('Acceptance: Setup', function () { // it redirects to the dashboard expect(currentURL(), 'url after submitting account details') - .to.equal('/setup/done'); + .to.equal('/dashboard'); }); it('handles validation errors in setup', async function () { @@ -182,9 +182,9 @@ describe('Acceptance: Setup', function () { await authenticateSession(); }); - it('transitions to done screen', async function () { + it('transitions to dashboard', async function () { await visit('/?firstStart=true'); - expect(currentURL()).to.equal('/setup/done'); + expect(currentURL()).to.equal('/dashboard'); }); }); }); diff --git a/ghost/core/core/shared/labs.js b/ghost/core/core/shared/labs.js index 84bc349e36..d946b0a8de 100644 --- a/ghost/core/core/shared/labs.js +++ b/ghost/core/core/shared/labs.js @@ -25,7 +25,6 @@ const GA_FEATURES = [ 'filterEmailDisabled', 'newEmailAddresses', 'portalImprovements', - 'onboardingChecklist', 'newsletterExcerpt' ]; diff --git a/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap b/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap index f5843f2a78..798621f81e 100644 --- a/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap +++ b/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap @@ -1155,7 +1155,7 @@ exports[`Settings API Edit Can edit a setting 2: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "4618", + "content-length": "4589", "content-type": "application/json; charset=utf-8", "content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,