From 3ee0c3ff53fc768b28c7f1fe9d255c68f8325345 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 10 Feb 2022 10:20:03 +0000 Subject: [PATCH] Fixed duplicate top-level properties after native class codemod refs https://github.com/TryGhost/Ghost/issues/14101 refs https://github.com/TryGhost/Admin/pull/2256 Before migrating to native classes we had a number of controllers/components that had an `.actions.foo` action and a `.foo` task. The automated migration to native classes didn't take that into account and we've ended up with duplicate top-level property names. These duplicates are confusing and can potentially lead to errors or unexpected behaviour, they'll also be flagged as linter errors when we bump our eslint version. - switched tasks with matching action names to `.actionTask` naming scheme --- ghost/admin/app/controllers/settings/general.js | 8 ++++---- ghost/admin/app/controllers/settings/integration.js | 8 ++++---- .../admin/app/controllers/settings/integrations/amp.js | 8 ++++---- .../controllers/settings/integrations/firstpromoter.js | 8 ++++---- .../app/controllers/settings/integrations/slack.js | 10 +++++----- .../app/controllers/settings/integrations/unsplash.js | 8 ++++---- ghost/admin/app/controllers/setup/two.js | 4 ++-- ghost/admin/app/controllers/signin.js | 4 ++-- ghost/admin/app/controllers/tag.js | 8 ++++---- ghost/admin/app/templates/settings/general.hbs | 2 +- ghost/admin/app/templates/settings/integration.hbs | 2 +- .../admin/app/templates/settings/integrations/amp.hbs | 2 +- .../templates/settings/integrations/firstpromoter.hbs | 2 +- .../app/templates/settings/integrations/slack.hbs | 2 +- .../app/templates/settings/integrations/unsplash.hbs | 2 +- ghost/admin/app/templates/setup/two.hbs | 2 +- ghost/admin/app/templates/tag.hbs | 2 +- 17 files changed, 41 insertions(+), 41 deletions(-) diff --git a/ghost/admin/app/controllers/settings/general.js b/ghost/admin/app/controllers/settings/general.js index 55e2da4700..463057e2ac 100644 --- a/ghost/admin/app/controllers/settings/general.js +++ b/ghost/admin/app/controllers/settings/general.js @@ -45,7 +45,7 @@ export default class GeneralController extends Controller { @action save() { - this.save.perform(); + this.saveTask.perform(); } @action @@ -121,8 +121,8 @@ export default class GeneralController extends Controller { this.set('leaveSettingsTransition', transition); // if a save is running, wait for it to finish then transition - if (this.save.isRunning) { - return this.save.last.then(() => { + if (this.saveTask.isRunning) { + return this.saveTask.last.then(() => { transition.retry(); }); } @@ -298,5 +298,5 @@ export default class GeneralController extends Controller { throw error; } }) - save; + saveTask; } diff --git a/ghost/admin/app/controllers/settings/integration.js b/ghost/admin/app/controllers/settings/integration.js index 85c8b7c0ce..74b5e1e665 100644 --- a/ghost/admin/app/controllers/settings/integration.js +++ b/ghost/admin/app/controllers/settings/integration.js @@ -95,7 +95,7 @@ export default class IntegrationController extends Controller { @action save() { - return this.save.perform(); + return this.saveTask.perform(); } @action @@ -112,8 +112,8 @@ export default class IntegrationController extends Controller { this.set('leaveScreenTransition', transition); // if a save is running, wait for it to finish then transition - if (this.save.isRunning) { - return this.save.last.then(() => { + if (this.saveTask.isRunning) { + return this.saveTask.last.then(() => { transition.retry(); }); } @@ -188,7 +188,7 @@ export default class IntegrationController extends Controller { @task(function* () { return yield this.integration.save(); }) - save; + saveTask; @task(function* () { copyTextToClipboard(this.integration.contentKey.secret); diff --git a/ghost/admin/app/controllers/settings/integrations/amp.js b/ghost/admin/app/controllers/settings/integrations/amp.js index a898e23fad..6ff9a18c71 100644 --- a/ghost/admin/app/controllers/settings/integrations/amp.js +++ b/ghost/admin/app/controllers/settings/integrations/amp.js @@ -19,7 +19,7 @@ export default class AmpController extends Controller { @action save() { - this.save.perform(); + this.saveTask.perform(); } @action @@ -36,8 +36,8 @@ export default class AmpController extends Controller { this.set('leaveSettingsTransition', transition); // if a save is running, wait for it to finish then transition - if (this.save.isRunning) { - return this.save.last.then(() => { + if (this.saveTask.isRunning) { + return this.saveTask.last.then(() => { transition.retry(); }); } @@ -72,5 +72,5 @@ export default class AmpController extends Controller { throw error; } }).drop()) - save; + saveTask; } diff --git a/ghost/admin/app/controllers/settings/integrations/firstpromoter.js b/ghost/admin/app/controllers/settings/integrations/firstpromoter.js index 7ca8c92ccc..37eff5cb08 100644 --- a/ghost/admin/app/controllers/settings/integrations/firstpromoter.js +++ b/ghost/admin/app/controllers/settings/integrations/firstpromoter.js @@ -19,7 +19,7 @@ export default class FirstpromoterController extends Controller { @action save() { - this.save.perform(); + this.saveTask.perform(); } @action @@ -36,8 +36,8 @@ export default class FirstpromoterController extends Controller { this.set('leaveSettingsTransition', transition); // if a save is running, wait for it to finish then transition - if (this.save.isRunning) { - return this.save.last.then(() => { + if (this.saveTask.isRunning) { + return this.saveTask.last.then(() => { transition.retry(); }); } @@ -72,5 +72,5 @@ export default class FirstpromoterController extends Controller { throw error; } }).drop()) - save; + saveTask; } diff --git a/ghost/admin/app/controllers/settings/integrations/slack.js b/ghost/admin/app/controllers/settings/integrations/slack.js index b5afc85bd4..42c47ce919 100644 --- a/ghost/admin/app/controllers/settings/integrations/slack.js +++ b/ghost/admin/app/controllers/settings/integrations/slack.js @@ -31,7 +31,7 @@ export default class SlackController extends Controller { @action save() { - this.save.perform(); + this.saveTask.perform(); } @action @@ -75,8 +75,8 @@ export default class SlackController extends Controller { this.set('leaveSettingsTransition', transition); // if a save is running, wait for it to finish then transition - if (this.save.isRunning) { - return this.save.last.then(() => { + if (this.saveTask.isRunning) { + return this.saveTask.last.then(() => { transition.retry(); }); } @@ -122,14 +122,14 @@ export default class SlackController extends Controller { } } }).drop()) - save; + saveTask; @(task(function* () { let notifications = this.notifications; let slackApi = this.get('ghostPaths.url').api('slack', 'test'); try { - yield this.save.perform(); + yield this.saveTask.perform(); yield this.ajax.post(slackApi); notifications.showNotification('Test notification sent', {type: 'info', key: 'slack-test.send.success', description: 'Check your Slack channel for the test message'}); return true; diff --git a/ghost/admin/app/controllers/settings/integrations/unsplash.js b/ghost/admin/app/controllers/settings/integrations/unsplash.js index 9c0310000b..a6bc8a262e 100644 --- a/ghost/admin/app/controllers/settings/integrations/unsplash.js +++ b/ghost/admin/app/controllers/settings/integrations/unsplash.js @@ -19,7 +19,7 @@ export default class UnsplashController extends Controller { @action save() { - this.save.perform(); + this.saveTask.perform(); } @action @@ -36,8 +36,8 @@ export default class UnsplashController extends Controller { this.set('leaveSettingsTransition', transition); // if a save is running, wait for it to finish then transition - if (this.save.isRunning) { - return this.save.last.then(() => { + if (this.saveTask.isRunning) { + return this.saveTask.last.then(() => { transition.retry(); }); } @@ -72,5 +72,5 @@ export default class UnsplashController extends Controller { throw error; } }).drop()) - save; + saveTask; } diff --git a/ghost/admin/app/controllers/setup/two.js b/ghost/admin/app/controllers/setup/two.js index 90e800c0e7..884fcdff62 100644 --- a/ghost/admin/app/controllers/setup/two.js +++ b/ghost/admin/app/controllers/setup/two.js @@ -33,7 +33,7 @@ export default class TwoController extends Controller.extend(ValidationEngine) { @action setup() { - this.setup.perform(); + this.setupTask.perform(); } @action @@ -52,7 +52,7 @@ export default class TwoController extends Controller.extend(ValidationEngine) { @task(function* () { return yield this._passwordSetup(); }) - setup; + setupTask; @task(function* (authStrategy, authentication) { // we don't want to redirect after sign-in during setup diff --git a/ghost/admin/app/controllers/signin.js b/ghost/admin/app/controllers/signin.js index d8a69c68c7..9a67371636 100644 --- a/ghost/admin/app/controllers/signin.js +++ b/ghost/admin/app/controllers/signin.js @@ -106,7 +106,7 @@ export default class SigninController extends Controller.extend(ValidationEngine return false; } }).drop()) - authenticate; + authenticateTask; @(task(function* () { let signin = this.signin; @@ -122,7 +122,7 @@ export default class SigninController extends Controller.extend(ValidationEngine try { yield this.validate({property: 'signin'}); - return yield this.authenticate + return yield this.authenticateTask .perform(authStrategy, [signin.get('identification'), signin.get('password')]); } catch (error) { this.set('flowErrors', 'Please fill out the form to sign in.'); diff --git a/ghost/admin/app/controllers/tag.js b/ghost/admin/app/controllers/tag.js index 12099ad6c7..6c11cc6ada 100644 --- a/ghost/admin/app/controllers/tag.js +++ b/ghost/admin/app/controllers/tag.js @@ -53,7 +53,7 @@ export default class TagController extends Controller { @action save() { - return this.save.perform(); + return this.saveTask.perform(); } @action @@ -70,8 +70,8 @@ export default class TagController extends Controller { this.set('leaveScreenTransition', transition); // if a save is running, wait for it to finish then transition - if (this.save.isRunning) { - return this.save.last.then(() => { + if (this.saveTask.isRunning) { + return this.saveTask.last.then(() => { transition.retry(); }); } @@ -111,7 +111,7 @@ export default class TagController extends Controller { } } }).drop()) - save; + saveTask; @task(function* (slug) { this.set('isLoading', true); diff --git a/ghost/admin/app/templates/settings/general.hbs b/ghost/admin/app/templates/settings/general.hbs index 925a880615..a78af46744 100644 --- a/ghost/admin/app/templates/settings/general.hbs +++ b/ghost/admin/app/templates/settings/general.hbs @@ -6,7 +6,7 @@ General
- +
diff --git a/ghost/admin/app/templates/settings/integration.hbs b/ghost/admin/app/templates/settings/integration.hbs index b183a271fe..17402937fb 100644 --- a/ghost/admin/app/templates/settings/integration.hbs +++ b/ghost/admin/app/templates/settings/integration.hbs @@ -1,5 +1,5 @@
-
+

Settings diff --git a/ghost/admin/app/templates/settings/integrations/amp.hbs b/ghost/admin/app/templates/settings/integrations/amp.hbs index 7617f3381c..4f921ba3db 100644 --- a/ghost/admin/app/templates/settings/integrations/amp.hbs +++ b/ghost/admin/app/templates/settings/integrations/amp.hbs @@ -8,7 +8,7 @@ AMP

- +
diff --git a/ghost/admin/app/templates/settings/integrations/firstpromoter.hbs b/ghost/admin/app/templates/settings/integrations/firstpromoter.hbs index 388e29d6f3..959de71b47 100644 --- a/ghost/admin/app/templates/settings/integrations/firstpromoter.hbs +++ b/ghost/admin/app/templates/settings/integrations/firstpromoter.hbs @@ -8,7 +8,7 @@ FirstPromoter
- +
diff --git a/ghost/admin/app/templates/settings/integrations/slack.hbs b/ghost/admin/app/templates/settings/integrations/slack.hbs index 60eed8fe6c..52aeab74b5 100644 --- a/ghost/admin/app/templates/settings/integrations/slack.hbs +++ b/ghost/admin/app/templates/settings/integrations/slack.hbs @@ -8,7 +8,7 @@ Slack
- +
diff --git a/ghost/admin/app/templates/settings/integrations/unsplash.hbs b/ghost/admin/app/templates/settings/integrations/unsplash.hbs index 111ba03a15..c9d716bd73 100644 --- a/ghost/admin/app/templates/settings/integrations/unsplash.hbs +++ b/ghost/admin/app/templates/settings/integrations/unsplash.hbs @@ -8,7 +8,7 @@ Unsplash
- +
diff --git a/ghost/admin/app/templates/setup/two.hbs b/ghost/admin/app/templates/setup/two.hbs index 2ade2bb9a9..0f18621888 100644 --- a/ghost/admin/app/templates/setup/two.hbs +++ b/ghost/admin/app/templates/setup/two.hbs @@ -83,7 +83,7 @@ - + {{#if task.isRunning}} {{svg-jar "spinner" class="gh-icon-spinner gh-btn-icon-no-margin"}} {{else}} diff --git a/ghost/admin/app/templates/tag.hbs b/ghost/admin/app/templates/tag.hbs index 441f1fcefc..0e6538a824 100644 --- a/ghost/admin/app/templates/tag.hbs +++ b/ghost/admin/app/templates/tag.hbs @@ -7,7 +7,7 @@ {{if this.tag.isNew "New tag" this.tag.name}}
- +