-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix links autocomplete suggestions: empty post title fallback #3575
fix links autocomplete suggestions: empty post title fallback #3575
Conversation
blocks/url-input/index.js
Outdated
@@ -215,7 +215,7 @@ class UrlInput extends Component { | |||
onClick={ () => this.props.onChange( post.link ) } | |||
aria-selected={ index === selectedSuggestion } | |||
> | |||
{ post.title.rendered } | |||
{ post.title.rendered || `( ${ __( 'no title' ) } )` } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a bit simpler like this: post.title.rendered || __( 'no title' )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can do that. I added the brackets so they are more in line with how no title posts are displayed in other places in WP admin as @afercia noted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry for the confusion, I see what you mean now and you're right we should add the parenthesis. post.title.rendered || __( '(no title)' )
A quick search in the WP source code shows that the parenthesis are included in the translated message.
Codecov Report
@@ Coverage Diff @@
## master #3575 +/- ##
=========================================
+ Coverage 35.15% 35.76% +0.6%
=========================================
Files 267 267
Lines 6724 6744 +20
Branches 1218 1221 +3
=========================================
+ Hits 2364 2412 +48
+ Misses 3683 3657 -26
+ Partials 677 675 -2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix
Description
Fixes #3573
How Has This Been Tested?
Manually tested in the browser.
Types of changes
Added fallback title for post with no title