mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
f8ccb81dfc
no issue - replaced access of `controller.{currentPath,currentRouteName}` with `router.currentRouteName` - https://deprecations.emberjs.com/v3.x/#toc_application-controller-router-properties
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
/* eslint-disable ghost/ember/alias-model-in-controller */
|
|
import Controller from '@ember/controller';
|
|
import {computed} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default Controller.extend({
|
|
dropdown: service(),
|
|
router: service(),
|
|
session: service(),
|
|
settings: service(),
|
|
ui: service(),
|
|
|
|
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 (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 (!session.isAuthenticated || !session.user.isFulfilled) {
|
|
return false;
|
|
}
|
|
|
|
return (router.currentRouteName !== 'error404' || session.isAuthenticated)
|
|
&& !router.currentRouteName.match(/(signin|signup|setup|reset)/);
|
|
})
|
|
});
|