/**
 * Indicates whether there might be an Automated Transfer process running on the backend for
 * a given site.
 *
 * For example, if a site is created through the 'store' signup flow and its plan is paid,
 * we try to transfer the site (automatically on the backend) so it can become a Store/Woo site.
 * However, the transfer process might not start immediately because of the transfer eligibility
 * reasons. That's where this selector comes handy.
 *
 * @param   {Object}  state  App state.
 * @param   {Number}  siteId Site of interest.
 * @returns {Boolean}        Whether there might be a transfer process happening on the backend.
 */
export default ( state, siteId ) => {
	const siteOptions = getSiteOptions( state, siteId );

	if ( ! siteOptions ) {
		return null;
	}

	// If the site is an Atomic one, there is no Automated Transfer process happening on the backend.
	if ( isSiteAutomatedTransfer( state, siteId ) ) {
		return false;
	}

	return get( siteOptions, 'has_pending_automated_transfer', false );
};
Пример #2
0
function canDeleteSite( state, siteId ) {
	const canManageOptions = canCurrentUser( state, siteId, 'manage_options' );

	if ( ! siteId || ! canManageOptions ) {
		// Current user doesn't have manage options to delete the site
		return false;
	}

	if ( isJetpackSite( state, siteId ) && ! isSiteAutomatedTransfer( state, siteId ) ) {
		// Current user can't delete a Jetpack site, but can request to delete an Atomic site
		return false;
	}

	if ( isVipSite( state, siteId ) ) {
		// Current user can't delete a VIP site
		return false;
	}

	return true;
}
Пример #3
0
const isAtomic = state => isSiteAutomatedTransfer( state, getSelectedSiteId( state ) );