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

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

Fixes broken tests on the legacy ember env.

diff --git a/app/assets/javascripts/admin/addon/components/dashboard-new-features.js b/app/assets/javascripts/admin/addon/components/dashboard-new-features.js
index 059e138..6e8defb 100644
--- a/app/assets/javascripts/admin/addon/components/dashboard-new-features.js
+++ b/app/assets/javascripts/admin/addon/components/dashboard-new-features.js
@@ -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,
diff --git a/app/assets/javascripts/discourse/app/controllers/create-account.js b/app/assets/javascripts/discourse/app/controllers/create-account.js
index 946ffd0..370f0c2 100644
--- a/app/assets/javascripts/discourse/app/controllers/create-account.js
+++ b/app/assets/javascripts/discourse/app/controllers/create-account.js
@@ -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
diff --git a/app/assets/javascripts/discourse/app/mixins/username-validation.js b/app/assets/javascripts/discourse/app/mixins/username-validation.js
index 522b40a..2e11cb7 100644
--- a/app/assets/javascripts/discourse/app/mixins/username-validation.js
+++ b/app/assets/javascripts/discourse/app/mixins/username-validation.js
@@ -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) {

GitHub sha: e41f98bf96b4c40428e6a308277c55907a9772ba

This commit appears in #15078 which was approved by eviltrout. It was merged by CvX.