Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

fix links autocomplete suggestions: empty post title fallback #3575

Merged
merged 3 commits into from Nov 21, 2017

Conversation

Projects
None yet
2 participants
Contributor

vladanost commented Nov 20, 2017

Description

Fixes #3573

How Has This Been Tested?

Manually tested in the browser.

Types of changes

Added fallback title for post with no title

blocks/url-input/index.js
@@ -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' ) } )` }
@youknowriad

youknowriad Nov 20, 2017

Collaborator

Maybe a bit simpler like this: post.title.rendered || __( 'no title' )

@vladanost

vladanost Nov 20, 2017

Contributor

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.

@youknowriad

youknowriad Nov 21, 2017

Collaborator

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.

@youknowriad youknowriad requested a review from afercia Nov 20, 2017

vladanost added some commits Nov 20, 2017

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.

Thanks for the fix

@youknowriad youknowriad merged commit a76e229 into WordPress:master Nov 21, 2017

2 checks passed

codecov/project 35.76% (+0.6%) compared to 2d50d76
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment