WordPress-iOS icon indicating copy to clipboard operation
WordPress-iOS copied to clipboard

Offline Mode: Fix an issue with restore revisions not clearing media uploads

Open kean opened this issue 1 year ago β€’ 3 comments

Fix an issue with "Restore Revision" feature not clearing media uploads. This issue is especially problematic if the post had media with terminal errors.

To test:

  • Mocking: make sure all media uploads fail
  • Open a draft post that has a couple of saved revisions ("History")
  • Add an image to the post and tap "Save as Draft"
  • Re-open the post for editing
  • Open "History" (revisions)
  • Load a revision that had no images
  • Tap "Save as Draft"
  • βœ… Verify that the post got uploaded

https://github.com/wordpress-mobile/WordPress-iOS/assets/1567433/f6a41c00-3553-4814-9957-a96166d8b5ac

Discussion

We'll might run into more issues due to the current media upload architecture, its relation to post content, and the fact that you can now open drafts with changes that are still syncing for editing. The problem is that the media is closely tied to the content. During sync, PostCoordinator updates the post content whenever a media upload complete (this is an existing behavior). It breaks the invariant that the saved revisions are immutable. Here's one problematic scenario:

  • Create and save a draft post
  • Save a new revision with an image (upload is pending & slow)
  • Open the post for editing but change nothing
  • Wait until the image upload completes
  • Tap "Back"

Expected behavior: the editor is closed Observed behavior: the editor shows a "Discard Change" confirmation dialog

Note: this is theoretical; I haven't yet tested it.

Regression Notes

  1. Potential unintended areas of impact: Post Editor & Media Uploads
  2. What I did to test those areas of impact (or what existing automated tests I relied on): n/a
  3. What automated tests I added (or what prevented me from doing so)

PR submission checklist:

  • [ ] I have completed the Regression Notes.
  • [ ] I have considered adding unit tests for my changes.
  • [ ] I have considered adding accessibility improvements for my changes.
  • [ ] I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing checklist:

  • [ ] WordPress.com sites and self-hosted Jetpack sites.
  • [ ] Portrait and landscape orientations.
  • [ ] Light and dark modes.
  • [ ] Fonts: Larger, smaller and bold text.
  • [ ] High contrast.
  • [ ] VoiceOver.
  • [ ] Languages with large words or with letters/accents not frequently used in English.
  • [ ] Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • [ ] iPhone and iPad.
  • [ ] Multi-tasking: Split view and Slide over. (iPad)

kean avatar Apr 25 '24 01:04 kean

WordPress AlphaπŸ“² You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr23082-58da440
Version24.7
Bundle IDorg.wordpress.alpha
Commit58da4402cbc6b816401b325e2b81e839f0ce553b
App Center BuildWPiOS - One-Offs #9750
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

wpmobilebot avatar Apr 25 '24 01:04 wpmobilebot

Jetpack AlphaπŸ“² You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr23082-58da440
Version24.7
Bundle IDcom.jetpack.alpha
Commit58da4402cbc6b816401b325e2b81e839f0ce553b
App Center Buildjetpack-installable-builds #8796
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

wpmobilebot avatar Apr 25 '24 01:04 wpmobilebot

Hi @kean πŸ‘‹ , I'm bumping this PR's milestone to 24.9 since I'm starting code freeze. Feel free to re-target this to the release branch if this is a blocker or intended for 24.8.

dvdchr avatar Apr 29 '24 08:04 dvdchr