-
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
Changes from 8 commits
a51751c
985df95
1658c61
a143269
e23beac
7a31236
4d85fa0
803ae8f
0dae8b5
036411e
5c6956c
7ba1648
61967f5
715a8eb
13c1285
ecc046a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ 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 { decodeEntities } from 'lib/formatting'; | ||
|
||
const ThemeSheet = React.createClass( { | ||
displayName: 'ThemeSheet', | ||
|
@@ -345,33 +346,53 @@ const ThemeSheet = React.createClass( { | |
const analyticsPath = `/theme/:slug${ section ? '/' + section : '' }${ siteID ? '/:site_id' : '' }`; | ||
const analyticsPageTitle = `Themes > Details Sheet${ section ? ' > ' + titlecase( section ) : '' }${ siteID ? ' > Site' : '' }`; | ||
|
||
const Head = this.props.isLoggedIn | ||
? require( 'layout/head' ) | ||
: require( 'my-sites/themes/head' ); | ||
|
||
const themeName = this.props.name; | ||
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. Just FYI, there's a neat shorthand for a construct like this, const { name: themeName } = this.props; |
||
const title = i18n.translate( '%(themeName)s Theme', { | ||
args: { themeName } | ||
} ); | ||
|
||
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> | ||
); | ||
}, | ||
|
||
|
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.
I'd really love if we could get rid of the conditional import while we're here; I'm quite sure
layout/head
is all we ever need here. You can read its source (and compare to what fields we override here inmain.jsx
) to validate that assumption -- or maybe just try without and compare resultingtitle
andmeta
s. :-)