Skip to content
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

Add Duplicate (Copy) Page functionality #13607

Merged
merged 6 commits into from
Dec 18, 2020
Merged

Conversation

antonis
Copy link
Contributor

@antonis antonis commented Dec 15, 2020

Fixes #13599

Description

This PR implements the "Duplicate page" functionality (already exists on Calypso) and is similar with the Duplicate Post functionality

To test

Duplicate published page

  1. From My Site press the Pages button or scroll down and select Site Pages from the list
  2. Create a new page or open a page by tapping on it
  3. Take a note of the title and content
  4. Press the dots at the right of the page listing
  5. Verify that the Duplicate button is visible
  6. Press the Duplicate button
  7. Expect to see an analytics event like the following 🔵 Tracked: site_pages_options_pressed, Properties: {"option_name":"copy","blog_id":174576032,"is_jetpack":false,"site_type":"blog"}
  8. Verify that the editor opens with the title and content from step 3
  9. Make a minor change
  10. Publish or exit to save the page as draft
  11. Verify that both the original and the duplicate pages are listed

Duplicate draft page

  1. From My Site press the Pages button or scroll down and select Site Pages from the list
  2. Select the Drafts (second) tab
  3. Create a new page or open a page by tapping on it
  4. Take a note of the title and content
  5. Press the dots at the right of the page listing
  6. Verify that the Duplicate button is visible
  7. Press the Duplicate button
  8. Expect to see an analytics event like the following 🔵 Tracked: site_pages_options_pressed, Properties: {"option_name":"copy","blog_id":174576032,"is_jetpack":false,"site_type":"blog"}
  9. Verify that the editor opens with the title and content from step 4
  10. Make a minor change
  11. Publish or exit to save the page as draft
  12. Verify that both the original and the duplicate pages are listed

Duplicate page with conflict

  1. From My Site press the Pages button or scroll down and select Site Pages from the list
  2. Create a new page or open a page by tapping on it
  3. Take a note of the title and content
  4. Press the dots at the right of the page listing
  5. Verify that the Duplicate button is visible
  6. Press the Duplicate button
  7. Expect to see an analytics event like the following 🔵 Tracked: site_pages_options_pressed, Properties: {"option_name":"copy","blog_id":174576032,"is_jetpack":false,"site_type":"blog"}
  8. Verify that the Conflict dialog(check screenshot below) appears

Edit page with conflict

  1. Follow the steps from Duplicate page with conflict above
  2. Select Edit the post first
  3. Verify that the conflict resolution dialogs appear and the post opens for editing

Duplicate local page

  1. Follow the steps from Duplicate page with conflict above
  2. Select Copy the version from this app
  3. Verify that the editor opens
  4. Make a minor change
  5. Publish or exit to save the page as draft
  6. Verify that both the original and the duplicate page are listed

Screenshots

Published pages actions Draft pages actions Conflict dialog
device-2020-12-15-175732 device-2020-12-15-175748 device-2020-12-15-175818

PR submission checklist:

  • I have considered adding unit tests where possible.
  • 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.

@antonis antonis added this to the 16.5 milestone Dec 15, 2020
@antonis antonis self-assigned this Dec 15, 2020
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Dec 15, 2020

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Dec 15, 2020

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

@antonis
Copy link
Contributor Author

antonis commented Dec 15, 2020

Hey @osullivanchris 👋
I was requested to extend the Duplicate Post functionality for pages. I implemented the UI to be the same with Duplicate Post based on your design.
The Duplicate action (as with posts) is present in Published and Draft pages. @mkevins suggested that we may allow the user to also duplicate posts (or pages) in other states (e.g. scheduled, pending). I think that implementation wise this should be simple. Wdyt?
Thank you in advance for your feedback🙇

@antonis antonis marked this pull request as ready for review December 15, 2020 16:49
@antonis
Copy link
Contributor Author

antonis commented Dec 17, 2020

To create Pages with version conflicts for testing purposes you can use the following steps:

  1. Create a new page and publish it
  2. Reopen the page
  3. Press the back button to exit the editor and save a local copy
  4. Delete the app from the device
  5. Install the app and login
  6. Notice the conflict warning on the page listing 🎉

This scenario is extreme but seems to consistently produce conflicts. cc @mkevins

Copy link
Contributor

@mkevins mkevins left a comment

Choose a reason for hiding this comment

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

Reviewed and tested on Pixel 3a (physical device). It is working as expected for all the described flows. Nice work Antonis! LGTM 👍

@antonis antonis merged commit 2a35009 into develop Dec 18, 2020
@antonis antonis deleted the feature/13599-copyPage branch December 18, 2020 13:12
@osullivanchris
Copy link

The Duplicate action (as with posts) is present in Published and Draft pages. @mkevins suggested that we may allow the user to also duplicate posts (or pages) in other states (e.g. scheduled, pending). I think that implementation wise this should be simple. Wdyt?

Hey @antonis, I must have missed this before the holidays. I think duplicating a scheduled or pending post is fine. I think the new duplicated post should behave like others - just being a plain draft with no schedule or pending status. Perhaps we need to tell the user in some way, is the only issue I can see.

I just captured draft and published as two examples in the mock, but covering all statuses is even better.

@antonis
Copy link
Contributor Author

antonis commented Jan 5, 2021

Hey @antonis, I must have missed this before the holidays. I think duplicating a scheduled or pending post is fine. I think the new duplicated post should behave like others - just being a plain draft with no schedule or pending status. Perhaps we need to tell the user in some way, is the only issue I can see.

Hello @osullivanchris 👋
Thank you for the feedback. I'll try to cover this with a separate PR.

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.

Android: Add Duplicate (Copy) Page functionality
3 participants