Fixed posts list hrefs showing "mobiledoc-editor" and added "editor-beta" redirects

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
This commit is contained in:
Kevin Ansfield 2023-10-04 14:28:58 +01:00
parent 4bdd8366ea
commit c56bfd51de
2 changed files with 21 additions and 2 deletions

View File

@ -45,7 +45,7 @@
{{/unless}}
</a>
{{else}}
<LinkTo @route="editor.edit" @models={{array this.post.displayName this.post.id}} class="permalink gh-list-data gh-post-list-title">
<LinkTo @route="lexical-editor.edit" @models={{array this.post.displayName this.post.id}} class="permalink gh-list-data gh-post-list-title">
<h3 class="gh-content-entry-title">
{{#if @post.featured}}
{{svg-jar "star-fill" class="gh-featured-post"}}
@ -206,7 +206,7 @@
</span>
</a>
{{else}}
<LinkTo @route="editor.edit" @models={{array this.post.displayName this.post.id}} class="permalink gh-list-data gh-post-list-button" title="">
<LinkTo @route="lexical-editor.edit" @models={{array this.post.displayName this.post.id}} class="permalink gh-list-data gh-post-list-button" title="">
<span class="gh-post-list-cta edit {{if this.isHovered "is-hovered"}}" title="Go to Editor" data-ignore-select>
{{svg-jar "pen" title="Go to Editor"}}
</span>

View File

@ -1,9 +1,28 @@
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