Skip to content
This repository has been archived by the owner on Feb 4, 2025. It is now read-only.

Post conflict resolution for self-hosted sites #2990

Merged
merged 2 commits into from
Apr 17, 2024
Merged

Conversation

pantstamp
Copy link
Contributor

@pantstamp pantstamp commented Apr 16, 2024

This PR contains the modifications needed for the new post conflict handling for the self-hosted sites that use XML-RPC calls. We are adding the if_not_modified_since parameter to the wp.edit call so we can get the 409 error code when there is a more recent revision of the post that we try to update.

Specs pcdRpT-5ID-p2#comment-9638.

WP Companion PR: wordpress-mobile/WordPress-Android#20651

To Test:

  • Check out trunk branch of the Jetpack and WordPress app. Replace FluxC hash with the one produced by this PR and build.

Test Post version forced write on top of web (existing logic)

  • Login with a self-hosted site that has posts. You can create a new self-hosted site using this tool.
  • Navigate to Me > Debug Settings
  • Disable the sync_publishing flag and restart the app
  • Navigate to back to My Site > Post
  • Tap the publish tab and then tap a post to open the edit view
  • PAUSE - GO TO YOUR LAPTOP
  • Open a browser and navigate to the same WordPress site
  • Open the same post and make an edit (remember what you changed)
  • Tap the "update" button to save it and back out of the editor
  • GO BACK TO YOUR DEVICE
  • Make a change to the post you have in the edit view
  • Tap "Update" to save the post to the server
  • ✅ Verify the post did update (snackbar)
  • GO BACK TO THE LAPTOP
  • Tap view on the same post you just edited via the app
  • ✅ Verify the changes you made on the device have overwritten the changes you made on your laptop
  • Repeat this test for Jetpack and Wordpress

Test Post version did not write on top of web (new logic)

  • Navigate to Me > Debug Settings
  • Enabled the sync_publishing flag and restart the app
  • Navigate to back to My Site > Post
  • Tap the publish tab and then tap a post to open the edit view
  • PAUSE - GO TO YOUR LAPTOP
  • Open a browser and navigate to the same WordPress site
  • Open the same post and make an edit (remember what you changed)
  • Tap the "update" button to save it and back out of the editor
  • GO BACK TO YOUR DEVICE
  • Make a change to the post you have in the edit view
  • Tap "Update" to save the post to the server
  • ✅ Verify the post did not update and the post list shows "Version Conflict" within the post row
  • GO BACK TO THE LAPTOP
  • Tap view on the same post you just edited via the app
  • ✅ Verify the changes you made on the device did not overwrite the changes you made on your laptop
  • Repeat this test for Jetpack and Wordpress

Test Conflict Resolution dialog is shown

  • Continue from the last step of test "Post version did not write on top of web (new logic)"
  • On the post list, tap on the post that shows "Version Conflict"
  • ✅ Verify the conflict resolution overlay is shown
  • Tap local version
  • ✅ Verify the local version has been applied
  • Repeat the scenario in test "Post version did not write on top of web (new logic)" to get into a Version Conflict again. Then repeat this test and tap web version in the conflict resolution dialog.

Regression Notes

  1. Potential unintended areas of impact
    The post is not updated properly

  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)
    Relied upon existing automated post tests


PR Submission Checklist:

  • I have completed the Regression Notes.
  • 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 (strike-out the not-applying and unnecessary ones): No UI components were changed with this PR

  • WordPress.com sites and self-hosted Jetpack sites.

@pantstamp pantstamp requested a review from zwarm April 16, 2024 17:29
@pantstamp pantstamp changed the title Adds: post conflict for self-hosted sites Adds: post conflict resolution for self-hosted sites Apr 17, 2024
@pantstamp pantstamp changed the title Adds: post conflict resolution for self-hosted sites Post conflict resolution for self-hosted sites Apr 17, 2024
@pantstamp pantstamp marked this pull request as ready for review April 17, 2024 10:54
Copy link
Contributor

@zwarm zwarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pantstamp - Works like a charm.
I left one minor suggestion. It's entirely up to you to decide to implement. 👍

@zwarm zwarm merged commit b5daa1e into trunk Apr 17, 2024
14 checks passed
@zwarm zwarm deleted the issue/post-conflict-xmlrpc branch April 17, 2024 13:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants