A platform for community discussion. Free, open, simple.
DEV: uses private API for currentPath (#7911)
Joffrey JAFFEUX8dfd0e0374c7
diff --git a/app/assets/javascripts/admin/controllers/admin.js.es6 b/app/assets/javascripts/admin/controllers/admin.js.es6index 2bca3824392..a79cf819444 100644--- a/app/assets/javascripts/admin/controllers/admin.js.es6+++ b/app/assets/javascripts/admin/controllers/admin.js.es6@@ -13,7 +13,7 @@ export default Ember.Controller.extend({return this.currentUser.get("admin") && enableBadges;},- @computed("router.currentRouteName")+ @computed("router._router.currentPath")adminContentsClassName(currentPath) {let cssClasses = currentPath.split(".")@@ -22,16 +22,15 @@ export default Ember.Controller.extend({segment !== "index" &&segment !== "loading" &&segment !== "show" &&- segment !== "admin" &&- segment !== "dashboard"+ segment !== "admin");}).map(Ember.String.dasherize).join(" ");// this is done to avoid breaking css customizations- if (currentPath.indexOf("admin.dashboard") > -1) {- cssClasses = `${cssClasses} dashboard dashboard-next`;+ if (cssClasses.includes("dashboard")) {+ cssClasses = `${cssClasses} dashboard-next`;}return cssClasses;diff --git a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6 b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6index 9a9cba115b7..0d087261a12 100644--- a/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6+++ b/app/assets/javascripts/discourse/controllers/user-private-messages.js.es6@@ -9,7 +9,7 @@ export default Ember.Controller.extend({pmView: false,viewingSelf: Ember.computed.alias("user.viewingSelf"),isGroup: Ember.computed.equal("pmView", "groups"),- currentPath: Ember.computed.alias("router.currentRouteName"),+ currentPath: Ember.computed.alias("router._router.currentPath"),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.es6index 661be19aaf9..5045cf55c48 100644--- a/app/assets/javascripts/discourse/controllers/user.js.es6+++ b/app/assets/javascripts/discourse/controllers/user.js.es6@@ -7,7 +7,7 @@ export default Ember.Controller.extend(CanCheckEmails, {indexStream: false,router: Ember.inject.service(),userNotifications: Ember.inject.controller("user-notifications"),- currentPath: Ember.computed.alias("router.currentRouteName"),+ currentPath: Ember.computed.alias("router._router.currentPath"),adminTools: optionalService(),@computed("model.username")diff --git a/app/assets/javascripts/discourse/templates/group.hbs b/app/assets/javascripts/discourse/templates/group.hbsindex 7e88c925e4c..6a7d2e0b14f 100644--- a/app/assets/javascripts/discourse/templates/group.hbs+++ b/app/assets/javascripts/discourse/templates/group.hbs@@ -56,7 +56,7 @@<div class="user-content-wrapper"><section class="user-primary-navigation"><div class="container">- {{group-navigation group=model currentPath=router.currentRouteName tabs=tabs}}+ {{group-navigation group=model currentPath=router._router.currentPath tabs=tabs}}</div></section>diff --git a/app/assets/javascripts/discourse/templates/group/activity.hbs b/app/assets/javascripts/discourse/templates/group/activity.hbsindex b6ca30345ed..24c06e20c90 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=router.currentRouteName}}+ {{#mobile-nav class='activity-nav' desktopClass='action-list activity-list nav-stacked' currentPath=router._router.currentPath}}{{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.hbsindex ff43273d40a..5ee0f8591f3 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=router.currentRouteName}}+ {{#mobile-nav class='activity-nav' desktopClass='action-list activity-list nav-stacked' currentPath=router._router.currentPath}}{{#each tabs as |tab|}}<li>{{#link-to tab.route model.name}}diff --git a/app/assets/javascripts/discourse/templates/group/messages.hbs b/app/assets/javascripts/discourse/templates/group/messages.hbsindex b567f2d031c..1d3edaa440b 100644--- a/app/assets/javascripts/discourse/templates/group/messages.hbs+++ b/app/assets/javascripts/discourse/templates/group/messages.hbs@@ -1,5 +1,5 @@<section class="user-secondary-navigation">- {{#mobile-nav class='messages-nav' desktopClass='nav-stacked action-list' currentPath=router.currentRouteName}}+ {{#mobile-nav class='messages-nav' desktopClass='nav-stacked action-list' currentPath=router._router.currentPath}}<li>{{#link-to 'group.messages.inbox' model.name}}diff --git a/app/assets/javascripts/discourse/templates/preferences.hbs b/app/assets/javascripts/discourse/templates/preferences.hbsindex 4a78a98f90d..3abd833348a 100644--- a/app/assets/javascripts/discourse/templates/preferences.hbs+++ b/app/assets/javascripts/discourse/templates/preferences.hbs@@ -1,5 +1,5 @@{{#d-section pageClass="user-preferences" class="user-secondary-navigation"}}- {{#mobile-nav class='preferences-nav' desktopClass='preferences-list action-list nav-stacked' currentPath=router.currentRouteName}}+ {{#mobile-nav class='preferences-nav' desktopClass='preferences-list action-list nav-stacked' currentPath=router._router.currentPath}}<li class='nav-account'>{{#link-to 'preferences.account'}}{{i18n 'user.preferences_nav.account'}}diff --git a/app/assets/javascripts/discourse/templates/user-card.hbs b/app/assets/javascripts/discourse/templates/user-card.hbsindex 3c23451b399..d06bb8ae001 100644--- a/app/assets/javascripts/discourse/templates/user-card.hbs+++ b/app/assets/javascripts/discourse/templates/user-card.hbs@@ -3,14 +3,14 @@{{/if}}{{user-card-contents- currentPath=router.currentRouteName+ currentPath=router._router.currentPathtopic=topic.modelshowUser=(action "showUser")togglePosts=(action "togglePosts")createNewMessageViaParams=(route-action "createNewMessageViaParams")}}{{group-card-contents- currentPath=router.currentRouteName+ currentPath=router._router.currentPathtopic=topic.modelshowUser=(action "showUser")showGroup=(action "showGroup")diff --git a/app/assets/javascripts/discourse/templates/user/activity.hbs b/app/assets/javascripts/discourse/templates/user/activity.hbsindex 2b1ea959a39..6c39cc46181 100644--- a/app/assets/javascripts/discourse/templates/user/activity.hbs+++ b/app/assets/javascripts/discourse/templates/user/activity.hbs@@ -1,5 +1,5 @@{{#d-section pageClass="user-activity" class="user-secondary-navigation" scrollTop="false"}}- {{#mobile-nav class='activity-nav' desktopClass='action-list activity-list nav-stacked' currentPath=router.currentRouteName}}+ {{#mobile-nav class='activity-nav' desktopClass='action-list activity-list nav-stacked' currentPath=router._router.currentPath}}<li>{{#link-to 'userActivity.index'}}{{i18n 'user.filters.all'}}{{/link-to}}</li>diff --git a/app/assets/javascripts/discourse/templates/user/notifications.hbs b/app/assets/javascripts/discourse/templates/user/notifications.hbsindex c968b42f9d2..fa74e925d3b 100644--- a/app/assets/javascripts/discourse/templates/user/notifications.hbs+++ b/app/assets/javascripts/discourse/templates/user/notifications.hbs@@ -1,5 +1,5 @@{{#d-section pageClass="user-notifications" class="user-secondary-navigation"}}- {{#mobile-nav class='notifications-nav' desktopClass='notification-list action-list nav-stacked' currentPath=router.currentRouteName}}+ {{#mobile-nav class='notifications-nav' desktopClass='notification-list action-list nav-stacked' currentPath=router._router.currentPath}}<li>{{#link-to 'userNotifications.index'}}{{i18n 'user.filters.all'}}diff --git a/app/assets/javascripts/discourse/widgets/header.js.es6 b/app/assets/javascripts/discourse/widgets/header.js.es6index b48b302bbcb..3db96d08033 100644--- a/app/assets/javascripts/discourse/widgets/header.js.es6+++ b/app/assets/javascripts/discourse/widgets/header.js.es6@@ -403,8 +403,8 @@ export default createWidget("header", {}const currentPath = this.register- .lookup("controller:application")- .get("currentPath");+ .lookup("service:router")+ .get("router._router.currentPath");if (currentPath === "full-page-search") {scrollTop();@@ -479,8 +479,8 @@ export default createWidget("header", {state.contextEnabled = false;const currentPath = this.register- .lookup("controller:application")- .get("currentPath");+ .lookup("service:router")+ .get("router._router.currentPath");const blacklist = [/^discovery\.categories/];const whitelist = [/^topic\./];const check = function(regex) {