mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
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
This commit is contained in:
parent
f1c8af662f
commit
3ee0c3ff53
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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.');
|
||||
|
@ -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);
|
||||
|
@ -6,7 +6,7 @@
|
||||
General
|
||||
</h2>
|
||||
<section class="view-actions">
|
||||
<GhTaskButton @buttonText="Save" @task={{this.save}} @class="gh-btn gh-btn-primary gh-btn-icon" data-test-button="save" />
|
||||
<GhTaskButton @buttonText="Save" @task={{this.saveTask}} @class="gh-btn gh-btn-primary gh-btn-icon" data-test-button="save" />
|
||||
</section>
|
||||
</GhCanvasHeader>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<section class="gh-canvas">
|
||||
<form {{action (perform "save") on="submit"}}>
|
||||
<form {{on "submit" (perform this.saveTask)}}>
|
||||
<GhCanvasHeader class="gh-canvas-header">
|
||||
<h2 class="gh-canvas-title" data-test-screen-title>
|
||||
<LinkTo @route="settings">Settings</LinkTo>
|
||||
|
@ -8,7 +8,7 @@
|
||||
AMP
|
||||
</h2>
|
||||
<section class="view-actions">
|
||||
<GhTaskButton @task={{this.save}} @class="gh-btn gh-btn-primary gh-btn-icon" data-test-save-button={{true}} />
|
||||
<GhTaskButton @task={{this.saveTask}} @class="gh-btn gh-btn-primary gh-btn-icon" data-test-save-button={{true}} />
|
||||
</section>
|
||||
</GhCanvasHeader>
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
FirstPromoter
|
||||
</h2>
|
||||
<section class="view-actions">
|
||||
<GhTaskButton @task={{this.save}} @class="gh-btn gh-btn-primary gh-btn-icon" data-test-save-button={{true}} />
|
||||
<GhTaskButton @task={{this.saveTask}} @class="gh-btn gh-btn-primary gh-btn-icon" data-test-save-button={{true}} />
|
||||
</section>
|
||||
</GhCanvasHeader>
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
Slack
|
||||
</h2>
|
||||
<section class="view-actions">
|
||||
<GhTaskButton @task={{this.save}} @class="gh-btn gh-btn-primary gh-btn-icon" data-test-save-button={{true}} />
|
||||
<GhTaskButton @task={{this.saveTask}} @class="gh-btn gh-btn-primary gh-btn-icon" data-test-save-button={{true}} />
|
||||
</section>
|
||||
</GhCanvasHeader>
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
Unsplash
|
||||
</h2>
|
||||
<section class="view-actions">
|
||||
<GhTaskButton @task={{this.save}} @class="gh-btn gh-btn-primary gh-btn-icon" data-test-save-button={{true}} />
|
||||
<GhTaskButton @task={{this.saveTask}} @class="gh-btn gh-btn-primary gh-btn-icon" data-test-save-button={{true}} />
|
||||
</section>
|
||||
</GhCanvasHeader>
|
||||
|
||||
|
@ -83,7 +83,7 @@
|
||||
<GhErrorMessage @errors={{this.errors}} @property="password" />
|
||||
</GhFormGroup>
|
||||
|
||||
<GhTaskButton @task={{this.setup}} @type="submit" @tabindex="5" @class="gh-btn gh-btn-green gh-btn-lg gh-btn-block gh-btn-icon" as |task|>
|
||||
<GhTaskButton @task={{this.setupTask}} @type="submit" @tabindex="5" @class="gh-btn gh-btn-green gh-btn-lg gh-btn-block gh-btn-icon" as |task|>
|
||||
{{#if task.isRunning}}
|
||||
<span>{{svg-jar "spinner" class="gh-icon-spinner gh-btn-icon-no-margin"}}</span>
|
||||
{{else}}
|
||||
|
@ -7,7 +7,7 @@
|
||||
{{if this.tag.isNew "New tag" this.tag.name}}
|
||||
</h2>
|
||||
<section class="view-actions">
|
||||
<GhTaskButton @task={{this.save}} @type="button" @class="gh-btn gh-btn-primary gh-btn-icon" @data-test-button="save" />
|
||||
<GhTaskButton @task={{this.saveTask}} @type="button" @class="gh-btn gh-btn-primary gh-btn-icon" @data-test-button="save" />
|
||||
</section>
|
||||
</GhCanvasHeader>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user