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:
Kevin Ansfield 2018-04-30 13:07:37 +01:00
parent 072a561be1
commit 7d95d42eda
2 changed files with 4 additions and 10 deletions

View File

@ -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)) {

View File

@ -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;
}
})
});
}