-
Notifications
You must be signed in to change notification settings - Fork 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
Add guards to decodeEntieties so it is not called with undefined. #6551
Merged
budzanowski
merged 16 commits into
master
from
fix/call_to_decodeentieties_with_undefined
Aug 1, 2016
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a51751c
Add guards to decodeEntieties so it is not called with undefined.
budzanowski 985df95
First draft for connected Head in main.jsx
budzanowski 1658c61
Remove decodeEntietis from SSR check
budzanowski a143269
Removing not used.
budzanowski e23beac
Correct linter warning and removed unused elements.
budzanowski 7a31236
Move Head to proper place.
budzanowski 4d85fa0
Linter warnings corrected.
budzanowski 803ae8f
Move makeElement to place where it is used.
budzanowski 0dae8b5
Use Head from layout and add missing TODO
budzanowski 036411e
Remove unnecessary prop and add default value for Header.
budzanowski 5c6956c
Head: Add propTypes
ockham 7ba1648
Themes: Pre-fill theme details on client side
ockham 61967f5
Head: CamelCase siteName
ockham 715a8eb
Revert "Themes: Pre-fill theme details on client side"
ockham 13c1285
Theme Sheet: Handle title and description fallbacks more gracefully
ockham ecc046a
Theme Sheet: Remove isRequired attr from defaultOption prop
ockham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,8 @@ import { getBackPath } from 'state/themes/themes-ui/selectors'; | |
import EmptyContentComponent from 'components/empty-content'; | ||
import ThemePreview from 'my-sites/themes/theme-preview'; | ||
import PageViewTracker from 'lib/analytics/page-view-tracker'; | ||
import Head from 'layout/head'; | ||
import { decodeEntities } from 'lib/formatting'; | ||
|
||
const ThemeSheet = React.createClass( { | ||
displayName: 'ThemeSheet', | ||
|
@@ -345,33 +347,49 @@ const ThemeSheet = React.createClass( { | |
const analyticsPath = `/theme/:slug${ section ? '/' + section : '' }${ siteID ? '/:site_id' : '' }`; | ||
const analyticsPageTitle = `Themes > Details Sheet${ section ? ' > ' + titlecase( section ) : '' }${ siteID ? ' > Site' : '' }`; | ||
|
||
const themeName = this.props.name; | ||
const title = i18n.translate( '%(themeName)s Theme', { | ||
args: { themeName } | ||
} ); // TODO: Use lib/screen-title's buildTitle. Cf. https://github.com/Automattic/wp-calypso/issues/3796 | ||
|
||
const canonicalUrl = `https://wordpress.com/theme/${ this.props.id }`; // TODO: use getDetailsUrl() When it becomes availavle | ||
|
||
return ( | ||
<Main className="theme__sheet"> | ||
<PageViewTracker path={ analyticsPath } title={ analyticsPageTitle }/> | ||
{ this.renderBar() } | ||
{ siteID && <QueryCurrentTheme siteId={ siteID }/> } | ||
<ThanksModal | ||
site={ this.props.selectedSite } | ||
source={ 'details' }/> | ||
{ this.state.showPreview && this.renderPreview() } | ||
<HeaderCake className="theme__sheet-action-bar" | ||
backHref={ this.props.backPath } | ||
backText={ i18n.translate( 'All Themes' ) }> | ||
{ this.renderButton() } | ||
</HeaderCake> | ||
<div className="theme__sheet-columns"> | ||
<div className="theme__sheet-column-left"> | ||
<div className="theme__sheet-content"> | ||
{ this.renderSectionNav( section ) } | ||
{ this.renderSectionContent( section ) } | ||
<div className="theme__sheet-footer-line"><Gridicon icon="my-sites" /></div> | ||
|
||
<Head | ||
title= { decodeEntities( title || '' ) + ' — WordPress.com' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please retain my TODO comment about using |
||
description={ decodeEntities( this.props.description || '' ) } | ||
type={ 'website' } | ||
canonicalUrl={ canonicalUrl } | ||
image={ this.props.screenshot } | ||
tier={ this.props.tier || 'all' }> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for this prop. |
||
<Main className="theme__sheet"> | ||
<PageViewTracker path={ analyticsPath } title={ analyticsPageTitle }/> | ||
{ this.renderBar() } | ||
{ siteID && <QueryCurrentTheme siteId={ siteID }/> } | ||
<ThanksModal | ||
site={ this.props.selectedSite } | ||
source={ 'details' }/> | ||
{ this.state.showPreview && this.renderPreview() } | ||
<HeaderCake className="theme__sheet-action-bar" | ||
backHref={ this.props.backPath } | ||
backText={ i18n.translate( 'All Themes' ) }> | ||
{ this.renderButton() } | ||
</HeaderCake> | ||
<div className="theme__sheet-columns"> | ||
<div className="theme__sheet-column-left"> | ||
<div className="theme__sheet-content"> | ||
{ this.renderSectionNav( section ) } | ||
{ this.renderSectionContent( section ) } | ||
<div className="theme__sheet-footer-line"><Gridicon icon="my-sites" /></div> | ||
</div> | ||
</div> | ||
<div className="theme__sheet-column-right"> | ||
{ this.renderScreenshot() } | ||
</div> | ||
</div> | ||
<div className="theme__sheet-column-right"> | ||
{ this.renderScreenshot() } | ||
</div> | ||
</div> | ||
</Main> | ||
</Main> | ||
</Head> | ||
); | ||
}, | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just FYI, there's a neat shorthand for a construct like this,