From 7d95d42edaae40ef9da56ec32f16fa12b4129c4c Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Mon, 30 Apr 2018 13:07:37 +0100 Subject: [PATCH] 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) --- ghost/admin/app/routes/application.js | 6 ++---- ghost/admin/app/utils/document-title.js | 8 ++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/ghost/admin/app/routes/application.js b/ghost/admin/app/routes/application.js index f3db797421..79d772f907 100644 --- a/ghost/admin/app/routes/application.js +++ b/ghost/admin/app/routes/application.js @@ -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)) { diff --git a/ghost/admin/app/utils/document-title.js b/ghost/admin/app/utils/document-title.js index a14875631b..0f12405902 100644 --- a/ghost/admin/app/utils/document-title.js +++ b/ghost/admin/app/utils/document-title.js @@ -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; - } + }) }); }