-
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
Jetpack Sites: Use active modules list added to /me/sites endpoint #1700
Changes from all commits
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 |
---|---|---|
|
@@ -7,14 +7,10 @@ module.exports = { | |
if ( ! selectedSite ) { | ||
return true; | ||
} | ||
if ( ! selectedSite || ! selectedSite.modulesFetched ) { | ||
return true; | ||
} | ||
if ( ! selectedSite.getModule( 'manage' ) || | ||
! selectedSite.getModule( 'manage' ).active ) { | ||
if ( ! selectedSite.isModuleActive( 'manage' ) ) { | ||
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. I think we should also add there another if:
for the case where we don't know yet if it can manage or not 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. Since the modules are now returned part of the 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. yup, I wasn't getting that there are no delay now. \o/ |
||
return false; | ||
} | ||
return true; | ||
}, | ||
|
||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,11 +63,6 @@ module.exports = React.createClass( { | |
MediaActions.setLibrarySelectedItems( nextProps.site.ID, [] ); | ||
} | ||
|
||
if ( nextProps.site && nextProps.site.jetpack && ! nextProps.site.modulesFetched && | ||
( ! this.props.site || this.props.site.ID !== nextProps.site.ID ) ) { | ||
nextProps.site.fetchModules(); | ||
} | ||
|
||
if ( ! nextProps.visible || this.props.visible === nextProps.visible ) { | ||
return; | ||
} | ||
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. This makes me happy to see removed 😃 |
||
|
@@ -76,11 +71,6 @@ module.exports = React.createClass( { | |
}, | ||
|
||
componentDidMount: function() { | ||
var site = this.props.site; | ||
if ( site && site.jetpack && ! site.modulesFetched ) { | ||
site.fetchModules(); | ||
} | ||
|
||
debug( '%s component mounted.', this.constructor.name ); | ||
|
||
this.statsTracking = {}; | ||
|
@@ -304,7 +294,7 @@ module.exports = React.createClass( { | |
action: 'confirm', | ||
label: this.translate( 'Continue' ), | ||
isPrimary: true, | ||
disabled: isDisabled || ! this.props.site || ( this.props.site.jetpack && ! this.props.site.modulesFetched ), | ||
disabled: isDisabled || ! this.props.site, | ||
onClick: this.setView.bind( this, ModalViews.GALLERY ) | ||
} ); | ||
} else { | ||
|
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 to note somewhere:
canManage
only exists on Jetpack sites, so we need to either checkselectedSite.jetpack
before calling it, or add the same method to a .com site in a way that makes sense. I'm not sure what the best solution is, but we pushed an update to check if the site is a Jetpack site before calling this to fix it in the meantime.