mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
Fixed "Route#router intimate API" deprecation notices
closes https://github.com/TryGhost/Ghost/issues/9603 - don't add a `setTitle` method on the router and instead call `window.document.title` directly so that we don't have to access `Route#router` (throws deprecation) or `Route#_router` (private and may break without notice)
This commit is contained in:
parent
072a561be1
commit
7d95d42eda
@ -35,12 +35,10 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
||||
feature: service(),
|
||||
ghostPaths: service(),
|
||||
notifications: service(),
|
||||
router: service(),
|
||||
settings: service(),
|
||||
tour: service(),
|
||||
ui: service(),
|
||||
// TODO: rename to `router` when we drop using of Route#router in our
|
||||
// document-title util
|
||||
routerService: service('router'),
|
||||
|
||||
shortcuts,
|
||||
|
||||
@ -197,7 +195,7 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
|
||||
}
|
||||
|
||||
let routeInfo = transition.handlerInfos[transition.handlerInfos.length - 1];
|
||||
let router = this.get('routerService');
|
||||
let router = this.get('router');
|
||||
let params = [];
|
||||
|
||||
for (let key of Object.keys(routeInfo.params)) {
|
||||
|
@ -39,7 +39,7 @@ export default function () {
|
||||
finalTitle = this.title;
|
||||
}
|
||||
|
||||
this.router.setTitle(finalTitle);
|
||||
window.document.title = finalTitle;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -50,10 +50,6 @@ export default function () {
|
||||
Router.reopen({
|
||||
updateTitle: on('didTransition', function () {
|
||||
this.send('collectTitleTokens', []);
|
||||
}),
|
||||
|
||||
setTitle(title) {
|
||||
window.document.title = title;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user