Upgrade to Ember 3.7.0

Upgrade to Ember 3.7.0

diff --git a/Gemfile b/Gemfile
index 5ee5675..44c6dc8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -49,7 +49,7 @@ gem 'onebox', '1.8.82'
 gem 'http_accept_language', '~>2.0.5', require: false
 
 gem 'ember-rails', '0.18.5'
-gem 'discourse-ember-source', '~> 3.5.1'
+gem 'discourse-ember-source', '~> 3.7.0'
 gem 'ember-handlebars-template', '0.8.0'
 gem 'barber'
 
diff --git a/Gemfile.lock b/Gemfile.lock
index ea2e1aa..f145e09 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -108,7 +108,7 @@ GEM
       terminal-table (~> 1)
     debug_inspector (0.0.3)
     diff-lcs (1.3)
-    discourse-ember-source (3.5.1.3)
+    discourse-ember-source (3.7.0.2)
     discourse_image_optim (0.26.2)
       exifr (~> 1.2, >= 1.2.2)
       fspath (~> 3.0)
@@ -466,7 +466,7 @@ DEPENDENCIES
   colored2
   cppjieba_rb
   danger
-  discourse-ember-source (~> 3.5.1)
+  discourse-ember-source (~> 3.7.0)
   discourse_image_optim
   email_reply_trimmer (~> 0.1)
   ember-handlebars-template (= 0.8.0)
diff --git a/app/assets/javascripts/admin/components/ace-editor.js.es6 b/app/assets/javascripts/admin/components/ace-editor.js.es6
index b86c0e4..b3576c8 100644
--- a/app/assets/javascripts/admin/components/ace-editor.js.es6
+++ b/app/assets/javascripts/admin/components/ace-editor.js.es6
@@ -100,7 +100,7 @@ export default Ember.Component.extend({
 
         if (this.appEvents) {
           // xxx: don't run during qunit tests
-          this.appEvents.on("ace:resize", () => this.resize());
+          this.appEvents.on("ace:resize", this, "resize");
         }
 
         if (this.get("autofocus")) {
diff --git a/app/assets/javascripts/admin/routes/admin-users-list-show.js.es6 b/app/assets/javascripts/admin/routes/admin-users-list-show.js.es6
index e893139..fba32be 100644
--- a/app/assets/javascripts/admin/routes/admin-users-list-show.js.es6
+++ b/app/assets/javascripts/admin/routes/admin-users-list-show.js.es6
@@ -10,12 +10,13 @@ export default Discourse.Route.extend({
     const routeName = "adminUsersList.show";
 
     if (transition.targetName === routeName) {
-      const params = transition.params[routeName];
+      const params = transition.routeInfos.find(a => a.name === routeName)
+        .params;
       const controller = this.controllerFor(routeName);
       if (controller) {
         controller.setProperties({
-          order: transition.queryParams.order,
-          ascending: transition.queryParams.ascending,
+          order: transition.to.queryParams.order,
+          ascending: transition.to.queryParams.ascending,
           query: params.filter,
           showEmails: false,
           refreshing: false
diff --git a/app/assets/javascripts/discourse/components/d-editor.js.es6 b/app/assets/javascripts/discourse/components/d-editor.js.es6
index 9987cf5..2b82d2e 100644
--- a/app/assets/javascripts/discourse/components/d-editor.js.es6
+++ b/app/assets/javascripts/discourse/components/d-editor.js.es6
@@ -290,25 +290,27 @@ export default Ember.Component.extend({
     });
 
     if (this.get("composerEvents")) {
-      this.appEvents.on("composer:insert-block", text =>
-        this._addBlock(this._getSelected(), text)
-      );
-      this.appEvents.on("composer:insert-text", (text, options) =>
-        this._addText(this._getSelected(), text, options)
-      );
-      this.appEvents.on("composer:replace-text", (oldVal, newVal, opts) =>
-        this._replaceText(oldVal, newVal, opts)
-      );
+      this.appEvents.on("composer:insert-block", this, "_insertBlock");
+      this.appEvents.on("composer:insert-text", this, "_insertText");
+      this.appEvents.on("composer:replace-text", this, "_replaceText");
     }
     this._mouseTrap = mouseTrap;
   },
 
+  _insertBlock(text) {
+    this._addBlock(this._getSelected(), text);
+  },
+
+  _insertText(text, options) {
+    this._addText(this._getSelected(), text, options);
+  },
+
   @on("willDestroyElement")
   _shutDown() {
     if (this.get("composerEvents")) {
-      this.appEvents.off("composer:insert-block");
-      this.appEvents.off("composer:insert-text");
-      this.appEvents.off("composer:replace-text");
+      this.appEvents.off("composer:insert-block", this, "_insertBlock");
+      this.appEvents.off("composer:insert-text", this, "_insertText");
+      this.appEvents.off("composer:replace-text", this, "_replaceText");
     }
 
     const mouseTrap = this._mouseTrap;
diff --git a/app/assets/javascripts/discourse/components/d-modal-body.js.es6 b/app/assets/javascripts/discourse/components/d-modal-body.js.es6
index 60f0d9a..a498875 100644
--- a/app/assets/javascripts/discourse/components/d-modal-body.js.es6
+++ b/app/assets/javascripts/discourse/components/d-modal-body.js.es6
@@ -14,14 +14,14 @@ export default Ember.Component.extend({
     }
 
     Ember.run.scheduleOnce("afterRender", this, this._afterFirstRender);
-    this.appEvents.on("modal-body:flash", msg => this._flash(msg));
-    this.appEvents.on("modal-body:clearFlash", () => this._clearFlash());
+    this.appEvents.on("modal-body:flash", this, "_flash");
+    this.appEvents.on("modal-body:clearFlash", this, "_clearFlash");
   },
 
   willDestroyElement() {
     this._super(...arguments);
-    this.appEvents.off("modal-body:flash");
-    this.appEvents.off("modal-body:clearFlash");
+    this.appEvents.off("modal-body:flash", this, "_flash");
+    this.appEvents.off("modal-body:clearFlash", this, "_clearFlash");
   },
 
   _afterFirstRender() {
diff --git a/app/assets/javascripts/discourse/components/discourse-topic.js.es6 b/app/assets/javascripts/discourse/components/discourse-topic.js.es6
index fd4ce8f..ff7c5ea 100644
--- a/app/assets/javascripts/discourse/components/discourse-topic.js.es6
+++ b/app/assets/javascripts/discourse/components/discourse-topic.js.es6
@@ -51,6 +51,27 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
     }
   },
 
+  _highlightPost(postNumber) {
+    Ember.run.scheduleOnce("afterRender", null, highlight, postNumber);
+  },
+
+  _updateTopic(topic) {
+    if (topic === null) {
+      this._lastShowTopic = false;
+      this.appEvents.trigger("header:hide-topic");
+      return;
+    }
+
+    const offset = window.pageYOffset || $("html").scrollTop();
+    this._lastShowTopic = this.showTopicInHeader(topic, offset);
+
+    if (this._lastShowTopic) {
+      this.appEvents.trigger("header:show-topic", topic);
+    } else {
+      this.appEvents.trigger("header:hide-topic");
+    }
+  },
+
   didInsertElement() {
     this._super(...arguments);
     this.bindScrolling({ name: "topic-view" });
@@ -81,26 +102,9 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
       }
     );
 
-    this.appEvents.on("post:highlight", postNumber => {
-      Ember.run.scheduleOnce("afterRender", null, highlight, postNumber);
-    });
-
-    this.appEvents.on("header:update-topic", topic => {
-      if (topic === null) {
-        this._lastShowTopic = false;
-        this.appEvents.trigger("header:hide-topic");
-        return;
-      }
-
-      const offset = window.pageYOffset || $("html").scrollTop();
-      this._lastShowTopic = this.showTopicInHeader(topic, offset);
+    this.appEvents.on("post:highlight", this, "_highlightPost");
 
-      if (this._lastShowTopic) {
-        this.appEvents.trigger("header:show-topic", topic);
-      } else {
-        this.appEvents.trigger("header:hide-topic");
-      }
-    });
+    this.appEvents.on("header:update-topic", this, "_updateTopic");
   },
 
   willDestroyElement() {
@@ -115,8 +119,8 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
 
     // this happens after route exit, stuff could have trickled in
     this.appEvents.trigger("header:hide-topic");
-    this.appEvents.off("post:highlight");
-    this.appEvents.off("header:update-topic");
+    this.appEvents.off("post:highlight", this, "_highlightPost");
+    this.appEvents.off("header:update-topic", this, "_updateTopic");
   },
 
   @observes("Discourse.hasFocus")

[... diff too long, it was truncated ...]

GitHub sha: f3d0d8fe

1 Like