Skip to content
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

Do not display post link when the Post Type is not viewable #11525

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 16 additions & 1 deletion packages/editor/src/components/post-publish-panel/postpublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,26 @@ class PostPublishPanelPostpublish extends Component {
const { children, isScheduled, post, postType } = this.props;
const postLabel = get( postType, [ 'labels', 'singular_name' ] );
const viewPostLabel = get( postType, [ 'labels', 'view_item' ] );
const isViewable = get( postType, [ 'viewable' ], false );

const postPublishNonLinkHeader = isScheduled ?
let postPublishNonLinkHeader = isScheduled ?
<Fragment>{ __( 'is now scheduled. It will go live on' ) } <PostScheduleLabel />.</Fragment> :
__( 'is now live.' );

if ( ! isViewable ) {
postPublishNonLinkHeader = isScheduled ?
<Fragment>{ __( 'is now scheduled. It will be published on' ) } <PostScheduleLabel />.</Fragment> :
__( 'is now published.' );

return (
<div className="post-publish-panel__postpublish">
<PanelBody className="post-publish-panel__postpublish-header">
{ post.title || __( '(no title)' ) } { postPublishNonLinkHeader }
</PanelBody>
</div>
);
}

return (
<div className="post-publish-panel__postpublish">
<PanelBody className="post-publish-panel__postpublish-header">
Expand Down