Skip to content

Offline Pages : Added Support for unpublished revision to Page List #11228

Merged
malinajirka merged 32 commits intofeature/master-pages-offline-supportfrom
unhandled_autosave
Feb 12, 2020
Merged

Offline Pages : Added Support for unpublished revision to Page List #11228
malinajirka merged 32 commits intofeature/master-pages-offline-supportfrom
unhandled_autosave

Conversation

@jd-alexander
Copy link
Copy Markdown
Contributor

@jd-alexander jd-alexander commented Feb 3, 2020

Fixes #11131

Findings

The Page List didn't support loading an unpublished revision when changes were made on other devices.

Solution

  • To reuse logic that allows the Post List to support this functionality. Most of this logic lives within the PostListDialogHelper. Since it has way more responsibilities than required in this PR, a PageListDialogHelper was created to extract only the functionality needed.

  • While adding this feature, I noticed that the Delete Page Confirmation Dialog was utilizing the BasicFragmentDialog and mixing both implementations would reduce code quality so I opted to migrate the Delete Confirmation Dialog to the PageListDialogHelper for consistency.

  • For the "You've made unsaved changes to this page" label, I didn't add it since @malinajirka will be working on a PR to refactor how labels are generated and that would cause a conflict.

  • I reused the tracking events from the PostListDialogHelper but I am wondering if pages need to be tracked separately from posts.

Testing

Page Auto Revision Testing

  1. Edit a page in WP Calypso and don't click save. You can monitor the network tab in the chrome debugging tools to see when an autosave request is made since this implementation doesn't contain a label.
  2. Ensure the device is online and then refresh the page.
  3. Click on the page that was edited online and you should see the dialog below.
Before Click After Click
  1. Verify that clicking The Version From Another Device shows the contents that exist in Calypso.
  2. Click back without saving and press the page again to verify that The Version From This App is accurate.

Page Deletion Testing

  1. Go to the Trash tab and click the More icon.
  2. Select Delete Permanently
  3. A dialog should be shown that asks you if you are sure you want to delete the page.
  4. Once you confirm the deletion, the page should be removed and the list should be empty. A snackbar should also be shown confirming deletion.
Before After

Reviewing

Only 1 reviewer is needed but anyone can review.

Submitter Checklist

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.
  • I have considered adding accessibility improvements for my changes.
  • If it's feasible, I have added unit tests.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Feb 3, 2020

You can test the changes on this Pull Request by downloading the APK here.

@jd-alexander jd-alexander changed the title Offline Pages : Support for unpublished revision to Page List Offline Pages : Added Support for unpublished revision to Page List Feb 4, 2020
@jd-alexander jd-alexander marked this pull request as ready for review February 4, 2020 20:32
@malinajirka malinajirka self-requested a review February 10, 2020 11:14
Copy link
Copy Markdown
Contributor

@malinajirka malinajirka left a comment

Choose a reason for hiding this comment

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

Great job @jd-alexander! I haven't found any major issues. I've left a couple of minor comments with some possible improvements. Let me know what you think ;)

To reuse logic that allows the Post List to support this functionality. Most of this logic lives within the PostListDialogHelper. Since it has way more responsibilities than required in this PR, a PageListDialogHelper was created to extract only the functionality needed.

We might want to consider extracting each dialog into its own class. That'd allow us to share the logic between the screens. But let's consider this during the cleanup phase of the project.

While adding this feature, I noticed that the Delete Page Confirmation Dialog was utilizing the BasicFragmentDialog and mixing both implementations would reduce code quality so I opted to migrate the Delete Confirmation Dialog to the PageListDialogHelper for consistency.

Good call ;)! It might be even better to separate it into a different PR, but it doesn't matter since this PR is pretty straightforward. Thanks!

I reused the tracking events from the PostListDialogHelper but I am wondering if pages need to be tracked separately from posts.

Hmm, we might want to consider adding something like "type:post/page" attribute to the event. Wdyt?

For the "You've made unsaved changes to this page" label, I didn't add it since @malinajirka will be working on a PR to refactor how labels are generated and that would cause a conflict.

👍

Btw I noticed branch names on your PRs don't follow the issue/[issue_number]_more_details pattern. AFAIK our CI doesn't count on the pattern, but I think it'd be good to follow it for consistency with other branch names.

@jd-alexander
Copy link
Copy Markdown
Contributor Author

Great job @jd-alexander! I haven't found any major issues. I've left a couple of minor comments with some possible improvements. Let me know what you think ;)

Awesome. Thanks again for another thoughtful review :bowtie:

We might want to consider extracting each dialog into its own class. That'd allow us to share the logic between the screens. But let's consider this during the cleanup phase of the project.

Indeed! I created an issue to track this #11272

Good call ;)! It might be even better to separate it into a different PR, but it doesn't matter since this PR is pretty straightforward. Thanks!

Thanks for the comment 😄

Hmm, we might want to consider adding something like "type:post/page" attribute to the event. Wdyt?

Makes sense! I added it ac2129b So I should create an issue to add this to the PostDialogHelper right?

Btw I noticed branch names on your PRs don't follow the issue/[issue_number]_more_details pattern. AFAIK our CI doesn't count on the pattern, but I think it'd be good to follow it for consistency with other branch names.

Thanks! I sometimes create a quick branch when I start playing around, renamed it locally and didn't realize I didn't push the new name. I will make sure all new PRs adhere to this from the start for sure 👍

@jkmassel
Copy link
Copy Markdown
Contributor

We're freezing 14.2 today, so this PR is being bumped to 14.3. If you'd like it to ship with 14.2, please merge it into release/14.2 and ping me – I'll be happy to cut a new beta release.

@malinajirka
Copy link
Copy Markdown
Contributor

Makes sense! I added it ac2129b So I should create an issue to add this to the PostDialogHelper right?

Thanks! Yeah, please create a ticket and link this usage there. I think we'll want share POST_TYPE to make sure no-one changes one place but forgets about the other.

Thank you for all the changes! It all LGTM. I'm merging this PR even though the connect tests are failing, since they are failing on a lot of the PRs. The issue is not related to this PR.

@malinajirka malinajirka merged commit 6b7a95b into feature/master-pages-offline-support Feb 12, 2020
@jd-alexander jd-alexander deleted the unhandled_autosave branch February 12, 2020 23:12
@malinajirka malinajirka modified the milestones: 14.3, 14.6 Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants