diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 6d8306c24..2fe6800c2 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -187,8 +187,9 @@ const DistributorPlugin = () => { const post = useSelect( ( select ) => select( 'core/editor' ).getCurrentPost() ); - // Make the post title available to the top menu. + // Make the post title and status available to the top menu. dt.postTitle = post.title; + dt.postStatus = post.status; // If we are on a non-supported post status, change what we show if ( diff --git a/assets/js/push.js b/assets/js/push.js index eb26e12db..4846c8185 100755 --- a/assets/js/push.js +++ b/assets/js/push.js @@ -50,7 +50,6 @@ jQuery( window ).on( 'load', () => { let selectAllConnections = ''; let selectNoConnections = ''; let connectionsSearchInput = ''; - let postStatusInput = ''; let asDraftInput = ''; let errorDetails = ''; @@ -91,7 +90,6 @@ jQuery( window ).on( 'load', () => { connectionsSearchInput = document.getElementById( 'dt-connection-search' ); - postStatusInput = document.getElementById( 'dt-post-status' ); asDraftInput = document.getElementById( 'dt-as-draft' ); errorDetails = document.querySelector( '.dt-error ul.details' ); @@ -516,7 +514,7 @@ jQuery( window ).on( 'load', () => { data.postStatus = null !== asDraftInput && asDraftInput.checked ? 'draft' - : postStatusInput.value; + : dt.postStatus; const xhr = dt.usexhr ? { withCredentials: true } : false; diff --git a/includes/push-ui.php b/includes/push-ui.php index b58a5ad7e..d883425ed 100644 --- a/includes/push-ui.php +++ b/includes/push-ui.php @@ -414,6 +414,7 @@ function enqueue_scripts( $hook ) { 'loadConnectionsNonce' => wp_create_nonce( 'dt-load-connections' ), 'postId' => (int) get_the_ID(), 'postTitle' => get_the_title(), + 'postStatus' => get_post_status(), 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ), /** diff --git a/templates/show-connections-amp.php b/templates/show-connections-amp.php index 98cdda683..a50833b5d 100644 --- a/templates/show-connections-amp.php +++ b/templates/show-connections-amp.php @@ -55,7 +55,6 @@ class="add-connection{{#syndicated}} syndicated{{/syndicated}}"
- post_status ) ? true : false; /** diff --git a/templates/show-connections.php b/templates/show-connections.php index cbc74ae68..cdfeb7c2f 100644 --- a/templates/show-connections.php +++ b/templates/show-connections.php @@ -53,7 +53,6 @@ class="add-connection<# if ( ! _.isEmpty( connections[ key ]['syndicated'] ) ) {
- post_status ) ? true : false; /**