Skip to content

Offline Support Pages : Cancel Auto Upload - #11266

Merged
malinajirka merged 46 commits into
feature/master-pages-offline-supportfrom
issue-11150/page_cancel_auto_upload
Feb 18, 2020
Merged

Offline Support Pages : Cancel Auto Upload#11266
malinajirka merged 46 commits into
feature/master-pages-offline-supportfrom
issue-11150/page_cancel_auto_upload

Conversation

@jd-alexander

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

Copy link
Copy Markdown
Contributor

Fixes #11150

Findings

The Post List has logic within PostListItemUiStateHelper that helps to determine which buttons should be shown based on several different conditions. This logic was adapted to create a similar behavior for the Page List cancel auto-upload functionality.

Solution

The PageItems had the actions hardcoded within its constructor. The actions were removed from them and added at instantiation so that logic could be run that determines if the Cancel button should be shown or not.

Issues Noticed

  • There's a crash that occurs at times when trying to fetch the post to determine if a page can be canceled or not, so a null check has to be done 0a035ad. I think this crash is related to the one taking place here Offline Support Pages - Update Page Status causes null post when fetching upload status #11260. I think the refactor here should resolve this.

  • Sometimes when a Scheduled post is saved, it doesn't show the Cancel action or the title doesn't get updated. I don't think that's related to this PR but it might need investigation.

  • I added a localId and remoteId to the PageItem because there are times when either is required. I renamed the id in PageItem to localId because it's often confusing when trying to determine which type of id should be used for a query 4caff1c. A further enhancement would be to simply change the types to LocalId and RemoteId so that that the compiler's type system enforces this across the featureset. I opted to leave this out of this PR. Should I create an issue for this or it can remain? since the name is already conveying the intent without changing the type.

Testing

  1. Put the device in airplane mode.
  2. Create a new page. Either a draft, published or scheduled page. Repeat all the steps below for each page type.
  3. Once the page has been created, publish it or save it.
  4. Click on the more button and you should see a “Cancel” button.
  5. Once you press cancel you should see a snackbar message saying that the changes won’t be published.
  6. Go back online and ensure that the page isn’t uploaded.
  7. Also, check other pages that haven’t been changed to ensure the “Cancel” action doesn’t show for them.
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.

@jd-alexander jd-alexander modified the milestones: 14.2, 14.3 Feb 7, 2020
@jd-alexander jd-alexander changed the title Offline Support Pages : Auto Upload Cancel Action Offline Support Pages : Cancel Auto Upload Feb 7, 2020
@peril-wordpress-mobile

peril-wordpress-mobile Bot commented Feb 7, 2020

Copy link
Copy Markdown

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

@jd-alexander

Copy link
Copy Markdown
Contributor Author

Hi @malinajirka this PR is ready for another review from a code standpoint! As discussed, we will need to resolve the scoping issue #11303 before this can be merged so I added the do not merge label just to be safe!

@jd-alexander

Copy link
Copy Markdown
Contributor Author

I merged #11315 into this and it works perfectly. Thanks!

@malinajirka malinajirka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @jd-alexander! I've reviewed the changes and tested the behavior. It all LGTM.

I've left two minor comments, but I'm approving this PR. Feel free to merge this PR.

@malinajirka

Copy link
Copy Markdown
Contributor

Thanks for the changes! ;) 🚢

@malinajirka
malinajirka merged commit f4df503 into feature/master-pages-offline-support Feb 18, 2020
@malinajirka
malinajirka deleted the issue-11150/page_cancel_auto_upload branch February 18, 2020 07:52
@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.

3 participants