mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 00:11:49 +03:00
7c84ef8c2d
closes https://github.com/TryGhost/Team/issues/2400 - used semver comparison to detect when the app version is less than the content-version header in any API response to toggle `upgradeStatus.requiresRefresh` that is used to conditionally show the upgrade banner - only works on minors as we don't store the full Ghost patch version in `config.APP.version`
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import Controller from '@ember/controller';
|
|
import {inject} from 'ghost-admin/decorators/inject';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class ApplicationController extends Controller {
|
|
@service billing;
|
|
@service explore;
|
|
@service router;
|
|
@service session;
|
|
@service settings;
|
|
@service ui;
|
|
@service upgradeStatus;
|
|
|
|
@inject config;
|
|
|
|
get showBilling() {
|
|
return this.config.hostSettings?.billing?.enabled;
|
|
}
|
|
|
|
get showNavMenu() {
|
|
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
|
|
// is populated so that gh-user-can-admin has the correct data
|
|
if (!session.isAuthenticated || !session.user) {
|
|
return false;
|
|
}
|
|
|
|
return (router.currentRouteName !== 'error404' || session.isAuthenticated)
|
|
&& !router.currentRouteName.match(/(signin|signup|setup|reset)/);
|
|
}
|
|
}
|