diff --git a/ghost/admin/app/controllers/lexical-editor.js b/ghost/admin/app/controllers/lexical-editor.js index 84a1bcb650..f6a3373cb3 100644 --- a/ghost/admin/app/controllers/lexical-editor.js +++ b/ghost/admin/app/controllers/lexical-editor.js @@ -790,7 +790,6 @@ export default class LexicalEditorController extends Controller { } serverSlug = yield this.slugGenerator.generateSlug('post', newSlug); - // If after getting the sanitized and unique slug back from the API // we end up with a slug that matches the existing slug, abort the change if (serverSlug === slug) { @@ -1229,6 +1228,25 @@ export default class LexicalEditorController extends Controller { } } + // Capture posts with untitled slugs and a title set; ref https://linear.app/ghost/issue/ONC-548/ + if (this.post) { + const slug = this.post.get('slug'); + const title = this.post.get('title'); + const isDraft = this.post.get('status') === 'draft'; + const slugContainsUntitled = slug.includes('untitled'); + const isTitleSet = title && title.trim() !== '' && title !== DEFAULT_TITLE; + + if (isDraft && slugContainsUntitled && isTitleSet) { + Sentry.captureException(new Error('Draft post has title set with untitled slug'), { + extra: { + slug: slug, + title: title, + titleScratch: this.post.get('titleScratch') + } + }); + } + } + // the transition is now certain to complete so cleanup and reset if // we're exiting the editor. new->edit keeps everything around and // edit->edit will call reset in the setPost method if necessary