Skip to content

Commit

Permalink
Hide previews for published posts on Jetpack sites
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme committed Jul 12, 2019
1 parent e617874 commit 264af29
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,23 @@ class RemotePreviewLogicHelper @Inject constructor(
helperFunctions.notifyEmptyDraft()
return PreviewLogicOperationResult.CANNOT_SAVE_EMPTY_DRAFT
}

helperFunctions.startUploading(false, updatedPost)
} else if (shouldRemoteAutoSave(updatedPost)) {
if (!postUtilsWrapper.isPublishable(updatedPost)) {
helperFunctions.notifyEmptyPost()
return PreviewLogicOperationResult.CANNOT_REMOTE_AUTO_SAVE_EMPTY_POST
}
// TODO: remove the following Jetpack exception when the API bug for Jetpack sites is fixed
// and previewing auto-saves are working. More informations about this on the following ticket:
// https://github.com/Automattic/wp-calypso/issues/20265
if (site.isJetpackConnected) {
activityLauncherWrapper.showActionableEmptyView(
activity,
WPWebViewUsageCategory.REMOTE_PREVIEW_NOT_AVAILABLE,
post.title
)
return PreviewLogicOperationResult.PREVIEW_NOT_AVAILABLE
}
helperFunctions.startUploading(true, updatedPost)
} else {
activityLauncherWrapper.previewPostOrPageForResult(
Expand Down

0 comments on commit 264af29

Please sign in to comment.