DEV: Upgrade to Ember 3.7.0 (#6977)

DEV: Upgrade to Ember 3.7.0 (#6977)

  • Upgrade to Ember 3.7.0

  • use ember source 3.7.0.2

  • fix mobile header

  • fix navigation

diff --git a/Gemfile b/Gemfile
index 45af6c0..8b2b897 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 299c7f9..3322700 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 bc9240d..b066805 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 4a112c7..d404252 100644
--- a/app/assets/javascripts/discourse/components/discourse-topic.js.es6
+++ b/app/assets/javascripts/discourse/components/discourse-topic.js.es6
@@ -77,9 +77,7 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
       }
     );
 
-    this.appEvents.on("post:highlight", postNumber => {
-      Ember.run.scheduleOnce("afterRender", null, highlight, postNumber);
-    });
+    this.appEvents.on("post:highlight", this, "_highlightPost");
 
     this.appEvents.on("header:update-topic", topic => {
       if (topic === null) {
@@ -99,23 +97,29 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
     });
     // setup mobile scroll logo
     if (this.site.mobileView) {
-      this.appEvents.on("topic:scrolled", offset =>
-        this.mobileScrollGaurd(offset)
-      );
+      this.appEvents.on("topic:scrolled", this, "mobileScrollGuard");
       // used to animate header contents on scroll
-      this.appEvents.on("header:show-topic", () => {
-        $("header.d-header")
-          .removeClass("scroll-up")
-          .addClass("scroll-down");
-      });
-      this.appEvents.on("header:hide-topic", () => {
-        $("header.d-header")
-          .removeClass("scroll-down")
-          .addClass("scroll-up");
-      });
+      this.appEvents.on("header:show-topic", this, "_showTopic");
+      this.appEvents.on("header:hide-topic", this, "_hideTopic");
     }
   },
 
+  _showTopic() {
+    $("header.d-header")
+      .removeClass("scroll-up")
+      .addClass("scroll-down");
+  },
+
+  _hideTopic() {
+    $("header.d-header")
+      .removeClass("scroll-down")
+      .addClass("scroll-up");
+  },
+
+  _highlightPost(postNumber) {
+    Ember.run.scheduleOnce("afterRender", null, highlight, postNumber);
+  },
+
   willDestroyElement() {
     this._super(...arguments);
     this.unbindScrolling("topic-view");
@@ -128,10 +132,10 @@ 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("post:highlight", this, "_highlightPost");
     // mobile scroll logo clean up.
     if (this.site.mobileView) {
-      this.appEvents.off("topic:scrolled");
+      this.appEvents.off("topic:scrolled", this, "mobileScrollGuard");

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

GitHub sha: 3eebf8be

1 Like

2 Likes

Revert "DEV: Upgrade to Ember 3.7.0 (#6977)" (#7165)