Skip to content
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

Conversation

vladanost
Copy link
Contributor

Description

Fixes #3573

How Has This Been Tested?

Manually tested in the browser.

Types of changes

Added fallback title for post with no title

@@ -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' ) } )` }
Copy link
Contributor

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' )

Copy link
Contributor Author

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.

Copy link
Contributor

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
Copy link

codecov bot commented Nov 21, 2017

Codecov Report

Merging #3575 into master will increase coverage by 0.6%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
blocks/url-input/index.js 20.96% <ø> (+17.74%) ⬆️
blocks/api/validation.js 91.46% <0%> (-3.7%) ⬇️
components/dashicon/index.js 5.56% <0%> (+0.71%) ⬆️
components/popover/index.js 85.71% <0%> (+0.95%) ⬆️
components/tooltip/index.js 78.72% <0%> (+6.38%) ⬆️
...ponents/higher-order/with-spoken-messages/index.js 83.33% <0%> (+16.66%) ⬆️
components/notice/index.js 100% <0%> (+100%) ⬆️
blocks/url-input/button.js 100% <0%> (+100%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d50d76...e40066d. Read the comment docs.

Copy link
Contributor

@youknowriad youknowriad left a 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

@youknowriad youknowriad merged commit a76e229 into WordPress:master Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Links autocomplete suggestions: posts with no title should have a fallback title
2 participants