DEV: removes application.currentPath deprecation (#7905)

DEV: removes application.currentPath deprecation (#7905)

See https://deprecations.emberjs.com/v3.x#toc_application-controller-router-properties for more context

diff --git a/app/assets/javascripts/admin/controllers/admin.js.es6 b/app/assets/javascripts/admin/controllers/admin.js.es6
index 9823f0f..ace435d 100644
--- a/app/assets/javascripts/admin/controllers/admin.js.es6
+++ b/app/assets/javascripts/admin/controllers/admin.js.es6
@@ -1,7 +1,7 @@
 import computed from "ember-addons/ember-computed-decorators";
 
 export default Ember.Controller.extend({
-  application: Ember.inject.controller(),
+  router: Ember.inject.service(),
 
   @computed("siteSettings.enable_group_directory")
   showGroups(enableGroupDirectory) {
@@ -13,7 +13,7 @@ export default Ember.Controller.extend({
     return this.currentUser.get("admin") && enableBadges;
   },
 
-  @computed("application.currentPath")
+  @computed("router.currentRouteName")
   adminContentsClassName(currentPath) {
     let cssClasses = currentPath
       .split(".")
diff --git a/app/assets/javascripts/discourse/controllers/group-activity.js.es6 b/app/assets/javascripts/discourse/controllers/group-activity.js.es6
index 86356ee..26fa948 100644
--- a/app/assets/javascripts/discourse/controllers/group-activity.js.es6
+++ b/app/assets/javascripts/discourse/controllers/group-activity.js.es6
@@ -1,4 +1,4 @@
 export default Ember.Controller.extend({
-  application: Ember.inject.controller(),
+  router: Ember.inject.service(),
   queryParams: ["category_id"]
 });
diff --git a/app/assets/javascripts/discourse/controllers/group-manage.js.es6 b/app/assets/javascripts/discourse/controllers/group-manage.js.es6
index 93e17ca..795627c 100644
--- a/app/assets/javascripts/discourse/controllers/group-manage.js.es6
+++ b/app/assets/javascripts/discourse/controllers/group-manage.js.es6
@@ -1,7 +1,7 @@
 import { default as computed } from "ember-addons/ember-computed-decorators";
 
 export default Ember.Controller.extend({
-  application: Ember.inject.controller(),
+  router: Ember.inject.service(),
 
   @computed("model.automatic")
   tabs(automatic) {
diff --git a/app/assets/javascripts/discourse/controllers/group-messages.js.es6 b/app/assets/javascripts/discourse/controllers/group-messages.js.es6
index d4180e8..cda126a 100644
--- a/app/assets/javascripts/discourse/controllers/group-messages.js.es6
+++ b/app/assets/javascripts/discourse/controllers/group-messages.js.es6
@@ -1,3 +1,3 @@
 export default Ember.Controller.extend({
-  application: Ember.inject.controller()
+  router: Ember.inject.service()
 });
diff --git a/app/assets/javascripts/discourse/controllers/preferences.js.es6 b/app/assets/javascripts/discourse/controllers/preferences.js.es6
index d4180e8..cda126a 100644
--- a/app/assets/javascripts/discourse/controllers/preferences.js.es6
+++ b/app/assets/javascripts/discourse/controllers/preferences.js.es6
@@ -1,3 +1,3 @@
 export default Ember.Controller.extend({
-  application: Ember.inject.controller()
+  router: Ember.inject.service()
 });
diff --git a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 b/app/assets/javascripts/discourse/controllers/user-activity.js.es6
index e214e58..d8e6f29 100644
--- a/app/assets/javascripts/discourse/controllers/user-activity.js.es6
+++ b/app/assets/javascripts/discourse/controllers/user-activity.js.es6
@@ -2,6 +2,7 @@ import { exportUserArchive } from "discourse/lib/export-csv";
 
 export default Ember.Controller.extend({
   application: Ember.inject.controller(),
+  router: Ember.inject.service(),
   user: Ember.inject.controller(),
   userActionType: null,
 
diff --git a/app/assets/javascripts/discourse/controllers/user-card.js.es6 b/app/assets/javascripts/discourse/controllers/user-card.js.es6
index cf84b13..0f26ea5 100644
--- a/app/assets/javascripts/discourse/controllers/user-card.js.es6
+++ b/app/assets/javascripts/discourse/controllers/user-card.js.es6
@@ -6,7 +6,7 @@ import {
 
 export default Ember.Controller.extend({
   topic: Ember.inject.controller(),
-  application: Ember.inject.controller(),
+  router: Ember.inject.service(),
 
   actions: {
     togglePosts(user) {
diff --git a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6
index 62fc7a2..9a9cba1 100644
--- a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6
+++ b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6
@@ -2,14 +2,14 @@ import computed from "ember-addons/ember-computed-decorators";
 import Topic from "discourse/models/topic";
 
 export default Ember.Controller.extend({
-  application: Ember.inject.controller(),
+  router: Ember.inject.service(),
   userTopicsList: Ember.inject.controller("user-topics-list"),
   user: Ember.inject.controller(),
 
   pmView: false,
   viewingSelf: Ember.computed.alias("user.viewingSelf"),
   isGroup: Ember.computed.equal("pmView", "groups"),
-  currentPath: Ember.computed.alias("application.currentPath"),
+  currentPath: Ember.computed.alias("router.currentRouteName"),
   selected: Ember.computed.alias("userTopicsList.selected"),
   bulkSelectEnabled: Ember.computed.alias("userTopicsList.bulkSelectEnabled"),
   showToggleBulkSelect: true,
diff --git a/app/assets/javascripts/discourse/controllers/user.js.es6 b/app/assets/javascripts/discourse/controllers/user.js.es6
index 0051d03..661be19 100644
--- a/app/assets/javascripts/discourse/controllers/user.js.es6
+++ b/app/assets/javascripts/discourse/controllers/user.js.es6
@@ -5,9 +5,9 @@ import optionalService from "discourse/lib/optional-service";
 
 export default Ember.Controller.extend(CanCheckEmails, {
   indexStream: false,
-  application: Ember.inject.controller(),
+  router: Ember.inject.service(),
   userNotifications: Ember.inject.controller("user-notifications"),
-  currentPath: Ember.computed.alias("application.currentPath"),
+  currentPath: Ember.computed.alias("router.currentRouteName"),
   adminTools: optionalService(),
 
   @computed("model.username")
diff --git a/app/assets/javascripts/discourse/templates/group.hbs b/app/assets/javascripts/discourse/templates/group.hbs
index 5ac0a81..7e88c92 100644
--- a/app/assets/javascripts/discourse/templates/group.hbs
+++ b/app/assets/javascripts/discourse/templates/group.hbs
@@ -56,10 +56,10 @@
 <div class="user-content-wrapper">
   <section class="user-primary-navigation">
     <div class="container">
-      {{group-navigation group=model currentPath=application.currentPath tabs=tabs}}
+      {{group-navigation group=model currentPath=router.currentRouteName tabs=tabs}}
     </div>
   </section>
 
         {{outlet}}
 </div>
-</div>
\ No newline at end of file
+</div>
diff --git a/app/assets/javascripts/discourse/templates/group/activity.hbs b/app/assets/javascripts/discourse/templates/group/activity.hbs
index ba0eaad..b6ca303 100644
--- a/app/assets/javascripts/discourse/templates/group/activity.hbs
+++ b/app/assets/javascripts/discourse/templates/group/activity.hbs
@@ -1,5 +1,5 @@
   <section class="user-secondary-navigation">
-  {{#mobile-nav class='activity-nav' desktopClass='action-list activity-list nav-stacked' currentPath=application.currentPath}}
+  {{#mobile-nav class='activity-nav' desktopClass='action-list activity-list nav-stacked' currentPath=router.currentRouteName}}
     {{group-activity-filter filter="posts" categoryId=category_id}}
     {{group-activity-filter filter="topics" categoryId=category_id}}
     {{#if siteSettings.enable_mentions}}
diff --git a/app/assets/javascripts/discourse/templates/group/manage.hbs b/app/assets/javascripts/discourse/templates/group/manage.hbs
index 583edec..ff43273 100644
--- a/app/assets/javascripts/discourse/templates/group/manage.hbs
+++ b/app/assets/javascripts/discourse/templates/group/manage.hbs
@@ -1,5 +1,5 @@
 <section class='user-secondary-navigation'>
-  {{#mobile-nav class='activity-nav' desktopClass='action-list activity-list nav-stacked' currentPath=application.currentPath}}
+  {{#mobile-nav class='activity-nav' desktopClass='action-list activity-list nav-stacked' currentPath=router.currentRouteName}}
     {{#each tabs as |tab|}}
       <li>

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

GitHub sha: f9c7d5a4

1 Like

This broke the left nav on /admin/customize/themes.

2 Likes

looking into this thx

2 Likes

Just FTR, the fix was done in DEV: uses private API for currentPath (#7911) · discourse/discourse@8dfd0e0 · GitHub, right?

yes it is the followup commit

1 Like