mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 10:42:45 +03:00
c56bfd51de
no issue - switched posts list over to using the `lexical-editor.edit` route so it uses the `/editor/` href rather than `/mobiledoc-editor/` - added redirect handling for the `/editor-beta/*` urls to our generic 404 route so anyone upgrading with the beta URLs still open in tabs or saved won't hit a 404
38 lines
893 B
JavaScript
38 lines
893 B
JavaScript
import Route from '@ember/routing/route';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class Error404Route extends Route {
|
|
controllerName = 'error';
|
|
templateName = 'error';
|
|
|
|
@service router;
|
|
|
|
beforeModel(transition) {
|
|
// handle redirects for old routes
|
|
if (transition.to?.params?.path?.startsWith?.('editor-beta')) {
|
|
const [, type, postId] = transition.to.params.path.split('/');
|
|
|
|
const route = postId ? 'lexical-editor.edit' : 'lexical-editor.new';
|
|
const models = [type];
|
|
|
|
if (postId) {
|
|
models.push(postId);
|
|
}
|
|
|
|
return this.router.transitionTo(route, ...models);
|
|
}
|
|
}
|
|
|
|
model() {
|
|
return {
|
|
status: 404
|
|
};
|
|
}
|
|
|
|
buildRouteInfoMetadata() {
|
|
return {
|
|
titleToken: 'Error'
|
|
};
|
|
}
|
|
}
|