diff --git a/_inc/client/components/jetpack-notices/index.jsx b/_inc/client/components/jetpack-notices/index.jsx
index 2e77b323c2864..546040ebe584e 100644
--- a/_inc/client/components/jetpack-notices/index.jsx
+++ b/_inc/client/components/jetpack-notices/index.jsx
@@ -12,8 +12,8 @@ import NoticesList from 'components/global-notices';
* Internal dependencies
*/
import JetpackStateNotices from './state-notices';
-import { getSiteConnectionStatus, getSiteDevMode, isStaging, isInIdentityCrisis } from 'state/connection';
-import { isDevVersion } from 'state/initial-state';
+import { getSiteConnectionStatus, getSiteDevMode, isStaging, isInIdentityCrisis, isCurrentUserLinked } from 'state/connection';
+import { isDevVersion, userCanManageModules, getUsername } from 'state/initial-state';
import DismissableNotices from './dismissable';
import { getConnectUrl as _getConnectUrl } from 'state/connection';
import QueryConnectUrl from 'components/data/query-connect-url';
@@ -159,15 +159,13 @@ export const UserUnlinked = React.createClass( {
render() {
if (
- ! window.Initial_State.userData.currentUser.isConnected &&
+ ! this.props.isLinked &&
this.props.connectUrl &&
this.props.siteConnected
) {
- let text;
-
- text = __( 'You, %(userName)s, are not connected to WordPress.com.', {
+ const text = __( 'You, %(userName)s, are not connected to WordPress.com.', {
args: {
- userName: window.Initial_State.userData.currentUser.username
+ userName: this.props.username
}
} );
@@ -215,7 +213,18 @@ const JetpackNotices = React.createClass( {
+ siteConnected={ true === this.props.siteConnectionStatus }
+ isLinked={ this.props.isLinked }
+ username={ this.props.username } />
+ {
+ ( ! this.props.siteConnectionStatus && ! this.props.userCanManageModules ) && (
+
+ )
+ }
);
}
@@ -226,11 +235,13 @@ export default connect(
return {
connectUrl: _getConnectUrl( state ),
siteConnectionStatus: getSiteConnectionStatus( state ),
+ userCanManageModules: userCanManageModules( state ),
+ username: getUsername( state ),
+ isLinked: isCurrentUserLinked( state ),
isDevVersion: isDevVersion( state ),
siteDevMode: getSiteDevMode( state ),
isStaging: isStaging( state ),
isInIdentityCrisis: isInIdentityCrisis( state )
-
};
}
)( JetpackNotices );
diff --git a/_inc/client/main.jsx b/_inc/client/main.jsx
index a639ff6ca88a4..fef1ac07acb0d 100644
--- a/_inc/client/main.jsx
+++ b/_inc/client/main.jsx
@@ -19,7 +19,7 @@ import SearchableSettings from 'settings/index.jsx';
import JetpackConnect from 'components/jetpack-connect';
import JumpStart from 'components/jumpstart';
import { getJumpStartStatus, isJumpstarting } from 'state/jumpstart';
-import { getSiteConnectionStatus } from 'state/connection';
+import { getSiteConnectionStatus, isCurrentUserLinked } from 'state/connection';
import {
setInitialState,
getSiteRawUrl,
@@ -116,6 +116,7 @@ const Main = React.createClass( {
return nextProps.siteConnectionStatus !== this.props.siteConnectionStatus ||
nextProps.jumpStartStatus !== this.props.jumpStartStatus ||
+ nextProps.isLinked !== this.props.isLinked ||
nextProps.route.path !== this.props.route.path ||
nextProps.searchTerm !== this.props.searchTerm;
},
@@ -154,11 +155,14 @@ const Main = React.createClass( {
analytics.tracks.recordEvent( 'jetpack_wpa_page_view', { path: route } );
if ( ! this.props.userCanManageModules ) {
- return
+ if ( ! this.props.siteConnectionStatus ) {
+ return false;
+ }
+ return ;
}
if ( ! this.props.siteConnectionStatus ) {
- return
+ return ;
}
if ( this.props.jumpStartStatus ) {
@@ -166,7 +170,7 @@ const Main = React.createClass( {
const history = createHistory();
history.push( window.location.pathname + '?page=jetpack#/jumpstart' );
} else if ( '/jumpstart' === route ) {
- return
+ return ;
}
}
@@ -241,6 +245,7 @@ export default connect(
jumpStartStatus: getJumpStartStatus( state ),
isJumpstarting: isJumpstarting( state ),
siteConnectionStatus: getSiteConnectionStatus( state ),
+ isLinked: isCurrentUserLinked( state ),
siteRawUrl: getSiteRawUrl( state ),
siteAdminUrl: getSiteAdminUrl( state ),
searchTerm: getSearchTerm( state ),