From 47d6c171352b30a5e5e158683088007caf48a127 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Thu, 12 May 2022 14:53:18 +0100 Subject: [PATCH] Settings cleanup (#2377) refs: https://github.com/TryGhost/Toolbox/issues/327 requires: TryGhost/Ghost#14791 - lang / locale has had a lot of churn, but we decided this setting should always be locale - Removed test relating to unused editor_is_launch_complete setting Co-authored-by: Rishabh --- ghost/admin/.lint-todo | 6 ++++++ .../components/gh-members-payments-setting.js | 2 +- ghost/admin/app/models/setting.js | 2 +- .../admin/app/templates/settings/general.hbs | 12 +++++------ ghost/admin/mirage/fixtures/settings.js | 2 +- .../dashboard/latest-member-activity-test.js | 21 ------------------- 6 files changed, 15 insertions(+), 30 deletions(-) diff --git a/ghost/admin/.lint-todo b/ghost/admin/.lint-todo index 89037bd540..e5385e6f71 100644 --- a/ghost/admin/.lint-todo +++ b/ghost/admin/.lint-todo @@ -1156,3 +1156,9 @@ add|ember-template-lint|require-input-label|170|36|170|36|0ba8ec96b755e459805e0c add|ember-template-lint|require-input-label|186|36|186|36|9522267520f8fbe733b544cd6f204b57efea84ea|1652227200000|1662595200000|1667782800000|app/components/editor-labs/modals/preview/social.hbs add|ember-template-lint|require-input-label|222|20|222|20|6ac7c49ee511b196817761756e03a7697e8dc448|1652227200000|1662595200000|1667782800000|app/components/editor-labs/modals/preview/social.hbs add|ember-template-lint|require-input-label|240|20|240|20|d3cc7e4d3b13fae817a60cd3c3e388988bdb8ec0|1652227200000|1662595200000|1667782800000|app/components/editor-labs/modals/preview/social.hbs +add|ember-template-lint|no-action|95|39|95|39|ba45af3e814e72ad4d95a8f317bb9cc9ad9215c8|1652313600000|1662681600000|1667865600000|app/templates/settings/general.hbs +add|ember-template-lint|no-action|96|43|96|43|2c1cc5f0c3aeddb4838344241fd5ad1706fa7f98|1652313600000|1662681600000|1667865600000|app/templates/settings/general.hbs +add|ember-template-lint|no-passed-in-event-handlers|95|32|95|32|c34c2e482b61c7ccd2b1103b5dee4b291eb2ec47|1652313600000|1662681600000|1667865600000|app/templates/settings/general.hbs +remove|ember-template-lint|no-action|95|39|95|39|3832366e419f440aded929f1573d476b8435f6ff|1652054400000|1662422400000|1665014400000|app/templates/settings/general.hbs +remove|ember-template-lint|no-action|96|43|96|43|659c404406f04b8153690817989630ae36f37989|1652054400000|1662422400000|1665014400000|app/templates/settings/general.hbs +remove|ember-template-lint|no-passed-in-event-handlers|95|32|95|32|50acf938ca8cb3c5633b20e7050d7750211b12f4|1652054400000|1662422400000|1665014400000|app/templates/settings/general.hbs diff --git a/ghost/admin/app/components/gh-members-payments-setting.js b/ghost/admin/app/components/gh-members-payments-setting.js index 7822e75d2c..9ef3ed295d 100644 --- a/ghost/admin/app/components/gh-members-payments-setting.js +++ b/ghost/admin/app/components/gh-members-payments-setting.js @@ -177,7 +177,7 @@ export default Component.extend({ const yearlyAmount = parseInt(this._scratchStripeYearlyAmount); const monthlyAmount = parseInt(this._scratchStripeMonthlyAmount); if (!yearlyAmount || yearlyAmount < 1 || !monthlyAmount || monthlyAmount < 1) { - const minimum = Intl.NumberFormat(this.settings.get('lang'), { + const minimum = Intl.NumberFormat(this.settings.get('locale'), { currency: selectedCurrency.isoCode, style: 'currency' }).format(1); diff --git a/ghost/admin/app/models/setting.js b/ghost/admin/app/models/setting.js index 16b58c1069..0565bd4fb8 100644 --- a/ghost/admin/app/models/setting.js +++ b/ghost/admin/app/models/setting.js @@ -12,7 +12,7 @@ export default Model.extend(ValidationEngine, { coverImage: attr('string'), icon: attr('string'), accentColor: attr('string'), - lang: attr('string'), + locale: attr('string'), timezone: attr('string', {defaultValue: 'Etc/UTC'}), codeinjectionHead: attr('string'), codeinjectionFoot: attr('string'), diff --git a/ghost/admin/app/templates/settings/general.hbs b/ghost/admin/app/templates/settings/general.hbs index a78af46744..8ef145a891 100644 --- a/ghost/admin/app/templates/settings/general.hbs +++ b/ghost/admin/app/templates/settings/general.hbs @@ -89,14 +89,14 @@
{{#liquid-if this.langOpen}}
- + - +

Default: English (en); you can add translation files to your theme for any language

diff --git a/ghost/admin/mirage/fixtures/settings.js b/ghost/admin/mirage/fixtures/settings.js index 6d2b8f3c55..973f80b078 100644 --- a/ghost/admin/mirage/fixtures/settings.js +++ b/ghost/admin/mirage/fixtures/settings.js @@ -42,7 +42,7 @@ export default [ }, { id: 5, - key: 'lang', + key: 'locale', value: 'en', group: 'site', created_at: '2013-11-25T14:48:11.000Z', diff --git a/ghost/admin/tests/integration/components/dashboard/latest-member-activity-test.js b/ghost/admin/tests/integration/components/dashboard/latest-member-activity-test.js index 531649aad4..f19863344c 100644 --- a/ghost/admin/tests/integration/components/dashboard/latest-member-activity-test.js +++ b/ghost/admin/tests/integration/components/dashboard/latest-member-activity-test.js @@ -1,5 +1,4 @@ import hbs from 'htmlbars-inline-precompile'; -import {authenticateSession} from 'ember-simple-auth/test-support'; import {describe, it} from 'mocha'; import {expect} from 'chai'; import {find, findAll, render} from '@ember/test-helpers'; @@ -27,24 +26,4 @@ describe('Integration: Component: ', function ( expect(findAll('[data-test-dashboard-member-activity-item]').length).to.equal(5); }); - - it('renders nothing when owner has not completed launch', async function () { - let role = this.server.create('role', {name: 'Owner'}); - this.server.create('user', {roles: [role]}); - await authenticateSession(); - const sessionService = this.owner.lookup('service:session'); - await sessionService.populateUser(); - - this.server.create('setting', { - key: 'editor_is_launch_complete', - value: false, - group: 'editor' - }); - const settingsService = this.owner.lookup('service:settings'); - await settingsService.fetch(); - - await render(hbs(``)); - - expect(find('[data-test-dashboard-member-activity]')).to.not.exist; - }); });