diff --git a/editor/components/post-publish-panel/prepublish.js b/editor/components/post-publish-panel/prepublish.js
index 0046045a523b0f..ce50a880a3d43a 100644
--- a/editor/components/post-publish-panel/prepublish.js
+++ b/editor/components/post-publish-panel/prepublish.js
@@ -1,8 +1,15 @@
+/**
+ * External dependencies
+ */
+import { get } from 'lodash';
+
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
+import { Fragment } from '@wordpress/element';
import { PanelBody } from '@wordpress/components';
+import { withSelect } from '@wordpress/data';
/**
* Internal Dependencies
@@ -12,26 +19,40 @@ import PostVisibilityLabel from '../post-visibility/label';
import PostSchedule from '../post-schedule';
import PostScheduleLabel from '../post-schedule/label';
-function PostPublishPanelPrepublish( { children } ) {
+function PostPublishPanelPrepublish( {
+ hasPublishAction,
+ children,
+} ) {
return (
-
{ __( 'Are you ready to publish?' ) }
-
{ __( 'Here, you can do a last-minute check up of your settings below, before you publish.' ) }
-
,
- ] }>
-
-
-
,
- ] }>
-
-
- { children }
+
{ hasPublishAction ? __( 'Are you ready to publish?' ) : __( 'Are you ready to submit for review?' ) }
+
{ hasPublishAction ? __( 'Here, you can do a last-minute check up of your settings below, before you publish.' ) : __( 'When you\'re ready, submit your work for review, and an Editor will be able to approve it for you.' ) }
+ { hasPublishAction && (
+
+ ,
+ ] }>
+
+
+ ,
+ ] }>
+
+
+ { children }
+
+ ) }
);
}
-export default PostPublishPanelPrepublish;
+export default withSelect(
+ ( select ) => {
+ const { getCurrentPost } = select( 'core/editor' );
+ return {
+ hasPublishAction: get( getCurrentPost(), [ '_links', 'wp:action-publish' ], false ),
+ };
+ }
+)( PostPublishPanelPrepublish );
diff --git a/editor/components/post-publish-panel/test/toggle.js b/editor/components/post-publish-panel/test/toggle.js
new file mode 100644
index 00000000000000..3226b638a3567b
--- /dev/null
+++ b/editor/components/post-publish-panel/test/toggle.js
@@ -0,0 +1,75 @@
+/**
+ * External dependencies
+ */
+import { shallow } from 'enzyme';
+
+/**
+ * Internal dependencies
+ */
+import { PostPublishPanelToggle } from '../toggle';
+
+describe( 'PostPublishPanelToggle', () => {
+ describe( 'disabled', () => {
+ it( 'should be disabled if post is currently saving', () => {
+ const wrapper = shallow(
+
+ );
+
+ expect( wrapper.prop( 'disabled' ) ).toBe( true );
+ } );
+
+ it( 'should be disabled if post is currently force saving', () => {
+ const wrapper = shallow(
+
+ );
+
+ expect( wrapper.prop( 'disabled' ) ).toBe( true );
+ } );
+
+ it( 'should be disabled if post is not publishable', () => {
+ const wrapper = shallow(
+
+ );
+
+ expect( wrapper.prop( 'disabled' ) ).toBe( true );
+ } );
+
+ it( 'should be disabled if post is not saveable', () => {
+ const wrapper = shallow(
+
+ );
+
+ expect( wrapper.prop( 'disabled' ) ).toBe( true );
+ } );
+
+ it( 'should be disabled if post is not published', () => {
+ const wrapper = shallow(
+
+ );
+
+ expect( wrapper.prop( 'disabled' ) ).toBe( true );
+ } );
+
+ it( 'should be enabled otherwise', () => {
+ const wrapper = shallow(
+
+ );
+
+ expect( wrapper.prop( 'disabled' ) ).toBe( false );
+ } );
+
+ it( 'should display Schedule… if able to be scheduled', () => {
+ const wrapper = shallow(
+
+ );
+ expect( wrapper.childAt( 0 ).text() ).toBe( 'Schedule…' );
+ } );
+
+ it( 'should display Publish… if able to be published', () => {
+ const wrapper = shallow(
+
+ );
+ expect( wrapper.childAt( 0 ).text() ).toBe( 'Publish…' );
+ } );
+ } );
+} );
diff --git a/editor/components/post-publish-panel/toggle.js b/editor/components/post-publish-panel/toggle.js
index 736b08f67a48a3..f51eebebd7fb2e 100644
--- a/editor/components/post-publish-panel/toggle.js
+++ b/editor/components/post-publish-panel/toggle.js
@@ -17,7 +17,7 @@ import { DotTip } from '@wordpress/nux';
*/
import PostPublishButton from '../post-publish-button';
-function PostPublishPanelToggle( {
+export function PostPublishPanelToggle( {
hasPublishAction,
isSaving,
isPublishable,