-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Hide previews for published posts on Jetpack sites #10212
Hide previews for published posts on Jetpack sites #10212
Conversation
Note: We should wait a week or so before merging that one, there is an upcoming API fix that might fix the underlying issue. |
I'm bumping this to If you'd like it to be released as part of |
@malinajirka @shiki - Jetpack sites are still affected by the bug (a fix was deployed for simple sites, but it doesn't fix the issue for Atomic and Jetpack sites). I think we should merge that one and revert it when the final API fix is deployed. |
@maxme Quick question on Case 3. I'm testing this on a Jurassic site. For a draft that's been uploaded to the server but with no changes, when I edit it:
Is this expected? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the given cases:
- Case 1: ✔️
- Case 2: ✔️
- Case 3: ❓
- Case 4: ✔️
For Case 3, I was testing with a sandbox and a Jurassic site and for both cases, it looks like this is getting called instead:
WordPress-Android/WordPress/src/main/java/org/wordpress/android/ui/posts/RemotePreviewLogicHelper.kt
Lines 49 to 54 in 264af29
if (!site.isUsingWpComRestApi) { | |
activityLauncherWrapper.showActionableEmptyView( | |
activity, | |
WPWebViewUsageCategory.REMOTE_PREVIEW_NOT_AVAILABLE, | |
post.title | |
) |
I think I'm misunderstanding what a Jetpack site is. I'll need your help in testing this. 😬
Also, another question. I noticed that in handlePostListAction
, we have PostListAction.PreviewPost
and PostListAction.ViewPost
. What is the difference between them? It looks like the More → Preview uses a different action than the Preview in the editor.
I think your jurassic.ninja site is not connected to your wordpress.com account, and act like a self hosted site instead of a Jetpack connected site:
The difference is that
I'll double check self hosted cases. IIRC we should show the preview in these cases for drafts. |
…utosave-preview-on-jetpack-site
After checking our discussion log, these 2 cases for wpcom / jetpack or self hosted sites should upload and preview drafts. It's not related to this fix, I'll open another PR to fix it. |
@shiki I added some useless tests to document the behavior (I'll add better tests for self hosted sites in the other fix). |
…ordpress-mobile/WordPress-Android into issue/10161-hide-autosave-preview-on-jetpack-site
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @maxme. LGTM! Thank you for adding tests!
The difference is that ViewPost will directly open the web view with the URL. PreviewPost will first try to upload or auto-save (depending on the post status) the post, wait for the server to reply, and then open the web view with the URL we got from server's response.
Thank you for the explanation. I guess I was just wondering why we have 2 actions that look very similar. Maybe they can be merged. 🤔 Definitely out of scope for this PR.
@Test | ||
fun `preview available for Jetpack sites on draft with modification`() { | ||
// Given | ||
// next stub not used (made lenient) in case we update future logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment and lenient()
is 🎉
Yes, they could be merged. Actually, the current implementation of "preview" behaves like "view" when there is no local change. It's just a matter of internal wiring. I wonder if we should change the UI as well, I'm not sure if the distinction between View/Preview is useful for users. |
That's a good idea. |
Fixes #10161: Hide previews for locally modified published posts on Jetpack connected sites
Case 1:
Case 2:
Case 3:
Case 4:
Demo video
Ping @osullivanchris - I wonder if we should show a specific message in that case (maybe have a look at the convo on p77Llu-cc4-p2 first).