DEV: Fix set-after-destroy issues (#15078)

Fixes broken tests on the legacy ember env.
This commit is contained in:
Jarek Radosz 2021-11-24 20:13:52 +01:00 committed by GitHub
parent 9380c1273e
commit e41f98bf96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -12,6 +12,10 @@ export default Component.extend({
this._super(...arguments);
ajax("/admin/dashboard/new-features.json").then((json) => {
if (!this.element || this.isDestroying || this.isDestroyed) {
return;
}
this.setProperties({
newFeatures: json.new_features,
hasUnseenFeatures: json.has_unseen_features,

View File

@ -211,6 +211,10 @@ export default Controller.extend(
return User.checkEmail(this.accountEmail)
.then((result) => {
if (this.isDestroying || this.isDestroyed) {
return;
}
if (result.failed) {
this.setProperties({
serverAccountEmail: this.accountEmail,
@ -356,6 +360,10 @@ export default Controller.extend(
this.set("formSubmitted", true);
return User.createAccount(attrs).then(
(result) => {
if (this.isDestroying || this.isDestroyed) {
return;
}
this.set("isDeveloper", false);
if (result.success) {
// invalidate honeypot

View File

@ -86,6 +86,10 @@ export default Mixin.create({
checkUsernameAvailability() {
return User.checkUsername(this.accountUsername, this.accountEmail).then(
(result) => {
if (this.isDestroying || this.isDestroyed) {
return;
}
this.set("isDeveloper", false);
if (result.available) {
if (result.is_developer) {