wordpress-mobile / WordPress-iOS

WordPress for iOS - Official repository
http://ios.wordpress.org/
GNU General Public License v2.0
3.7k stars 1.12k forks source link

Post preview not available for self hosted websites #13477

Open pmusolino opened 4 years ago

pmusolino commented 4 years ago

Expected behavior

See the preview of a Wordpress post also for a self-hosted website

Actual behavior

I always get an empty state screen when I try to see the preview of a post for a self-hosted website. Everything runs well for WP.com websites.

Steps to reproduce the behavior

1) Try to get the preview of a post on a self-hosted website. 2) You will see the empty screen, with no other details. 3) Try to get the preview of a post on a WP.com website. 4) You will be able to see the preview.

img_6919

Tested on [device], iOS [version], WPiOS [version]

Device: iPhone X iOS: 13.3.1 WPiOS: 14.1 and 14.2 beta

rachelmcr commented 4 years ago

I tested self-hosted previews in multiple scenarios. In the following scenarios, previewing a post works as expected:

The preview fails in this scenario:

  1. Open an existing draft or published post.
  2. Edit the post content.
  3. Preview the post.

The app logs show an error related to the autosave action that happens before previewing:

2020-02-19 13:58:49:047 Error while trying to save post before preview: Optional(Error Domain=PostServiceErrorDomain Code=0 "Previews are unavailable for this kind of post." UserInfo={NSLocalizedDescription=Previews are unavailable for this kind of post.})
designsimply commented 4 years ago

Support was launched for auto-upload and remote previews in WPAndroid 13.4 with the following known issues:

Preview isn’t supported for posts with local changes. Preview unavailable (can’t remote auto save on self hosted).

Source: p77Llu-cHb-p2.

Also see https://github.com/wordpress-mobile/WordPress-Android/pull/10536/commits/fbaa636e244e95cc033496c21dd980b5949a4571.

This is a good issue to have on file as a request though!

maxme commented 4 years ago

This is currently a limitation of the API on self hosted: we can't save a published post without publishing the changes. Maybe we could change the message in that case, but it's hard to explain this concisely to our users.