Fixed deprecated access of `controller.{currentPath,currentRouteName}`
no issue - replaced access of `controller.{currentPath,currentRouteName}` with `router.currentRouteName` - https://deprecations.emberjs.com/v3.x/#toc_application-controller-router-properties
This commit is contained in:
parent
292fe95932
commit
f9de54aa18
|
@ -5,23 +5,26 @@ import {inject as service} from '@ember/service';
|
|||
|
||||
export default Controller.extend({
|
||||
dropdown: service(),
|
||||
router: service(),
|
||||
session: service(),
|
||||
settings: service(),
|
||||
ui: service(),
|
||||
|
||||
showNavMenu: computed('currentPath', 'session.{isAuthenticated,user.isFulfilled}', 'ui.isFullScreen', function () {
|
||||
showNavMenu: computed('router.currentRouteName', 'session.{isAuthenticated,user.isFulfilled}', 'ui.isFullScreen', function () {
|
||||
let {router, session, ui} = this;
|
||||
|
||||
// if we're in fullscreen mode don't show the nav menu
|
||||
if (this.ui.isFullScreen) {
|
||||
if (ui.isFullScreen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// we need to defer showing the navigation menu until the session.user
|
||||
// promise has fulfilled so that gh-user-can-admin has the correct data
|
||||
if (!this.get('session.isAuthenticated') || !this.get('session.user.isFulfilled')) {
|
||||
if (!session.isAuthenticated || !session.user.isFulfilled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (this.currentPath !== 'error404' || this.get('session.isAuthenticated'))
|
||||
&& !this.currentPath.match(/(signin|signup|setup|reset)/);
|
||||
return (router.currentRouteName !== 'error404' || session.isAuthenticated)
|
||||
&& !router.currentRouteName.match(/(signin|signup|setup|reset)/);
|
||||
})
|
||||
});
|
||||
|
|
|
@ -4,9 +4,9 @@ import {alias} from '@ember/object/computed';
|
|||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default Controller.extend({
|
||||
applicationController: controller('application'),
|
||||
tagsController: controller('settings.tags'),
|
||||
notifications: service(),
|
||||
router: service(),
|
||||
|
||||
showDeleteTagModal: false,
|
||||
|
||||
|
@ -77,7 +77,7 @@ export default Controller.extend({
|
|||
},
|
||||
|
||||
_deleteTagSuccess() {
|
||||
let currentRoute = this.get('applicationController.currentRouteName') || '';
|
||||
let currentRoute = this.router.currentRouteName || '';
|
||||
|
||||
if (currentRoute.match(/^settings\.tags/)) {
|
||||
this.transitionToRoute('settings.tags.index');
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/* eslint-disable ghost/ember/alias-model-in-controller */
|
||||
import Controller, {inject as controller} from '@ember/controller';
|
||||
import Controller from '@ember/controller';
|
||||
import {computed} from '@ember/object';
|
||||
import {match} from '@ember/object/computed';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default Controller.extend({
|
||||
appController: controller('application'),
|
||||
ghostPaths: service(),
|
||||
router: service(),
|
||||
|
||||
showBackLink: match('appController.currentRouteName', /^setup\.(two|three)$/),
|
||||
showBackLink: match('router.currentRouteName', /^setup\.(two|three)$/),
|
||||
|
||||
backRoute: computed('appController.currentRouteName', function () {
|
||||
let currentRoute = this.get('appController.currentRouteName');
|
||||
backRoute: computed('router.currentRouteName', function () {
|
||||
let currentRoute = this.router.currentRouteName;
|
||||
|
||||
return currentRoute === 'setup.two' ? 'setup.one' : 'setup.two';
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue