Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/reader-activation/sync/class-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static function can_sync( $return_errors = false ) {
) {
$errors->add(
'esp_sync_not_allowed',
__( 'Sync is disabled for non-production sites. Set NEWSPACK_ALLOW_READER_SYNC to allow sync.', 'newspack-plugin' )
__( 'Sync is disabled for staging sites. To bypass this check, set the NEWSPACK_ALLOW_READER_SYNC constant in your wp-config.php.', 'newspack-plugin' )
);
}

Expand Down
2 changes: 2 additions & 0 deletions includes/wizards/class-engagement-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ public function api_get_reader_activation_settings() {
'config' => Reader_Activation::get_settings(),
'prerequisites_status' => Reader_Activation::get_prerequisites_status(),
'memberships' => self::get_memberships_settings(),
'can_esp_sync' => Reader_Activation\ESP_Sync::can_esp_sync( true ),
]
);
}
Expand Down Expand Up @@ -278,6 +279,7 @@ public function api_update_reader_activation_settings( $request ) {
'config' => Reader_Activation::get_settings(),
'prerequisites_status' => Reader_Activation::get_prerequisites_status(),
'memberships' => self::get_memberships_settings(),
'can_esp_sync' => Reader_Activation\ESP_Sync::can_esp_sync( true ),
]
);
}
Expand Down
13 changes: 11 additions & 2 deletions src/wizards/engagement/views/reader-activation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default withWizardScreen( ( { wizardApiFetch } ) => {
const [ prerequisites, setPrerequisites ] = useState( null );
const [ missingPlugins, setMissingPlugins ] = useState( [] );
const [ showAdvanced, setShowAdvanced ] = useState( false );
const [ espSyncErrors, setEspSyncErrors ] = useState( [] );
const updateConfig = ( key, val ) => {
setConfig( { ...config, [ key ]: val } );
};
Expand All @@ -48,10 +49,11 @@ export default withWizardScreen( ( { wizardApiFetch } ) => {
apiFetch( {
path: '/newspack/v1/wizard/newspack-engagement-wizard/reader-activation',
} )
.then( ( { config: fetchedConfig, prerequisites_status, memberships } ) => {
.then( ( { config: fetchedConfig, prerequisites_status, memberships, can_esp_sync } ) => {
setPrerequisites( prerequisites_status );
setConfig( fetchedConfig );
setMembershipsConfig( memberships );
setEspSyncErrors( can_esp_sync.errors );
} )
.catch( setError )
.finally( () => setInFlight( false ) );
Expand All @@ -65,10 +67,11 @@ export default withWizardScreen( ( { wizardApiFetch } ) => {
quiet: true,
data,
} )
.then( ( { config: fetchedConfig, prerequisites_status, memberships } ) => {
.then( ( { config: fetchedConfig, prerequisites_status, memberships, can_esp_sync } ) => {
setPrerequisites( prerequisites_status );
setConfig( fetchedConfig );
setMembershipsConfig( memberships );
setEspSyncErrors( can_esp_sync.errors );
} )
.catch( setError )
.finally( () => setInFlight( false ) );
Expand Down Expand Up @@ -352,6 +355,12 @@ export default withWizardScreen( ( { wizardApiFetch } ) => {
>
{ config.sync_esp && (
<>
{ 0 < Object.keys(espSyncErrors).length && (
<Notice
noticeText={ Object.values(espSyncErrors).join( ' ' ) }
isError
/>
) }
{ isMailchimp && (
<Mailchimp
value={ {
Expand Down