mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 19:48:50 +03:00
Added Sentry logging in editor for incorrectly untitled slug values (#21682)
ref https://linear.app/ghost/issue/ONC-548/ We seem to occasionally get into a state where draft posts are stuck with an untitled slug, which has been difficult to reproduce. It would be helpful to gather some data on how frequently this is happening.
This commit is contained in:
parent
7083bd0628
commit
588979e62f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user