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

Fix NullPointerException on singleUserSite access #19523

Merged
merged 4 commits into from
Nov 3, 2023

Conversation

zwarm
Copy link
Contributor

@zwarm zwarm commented Nov 2, 2023

Fixes #19518
Sentry Issue: WORDPRESS-ANDROID-2S4V

This fixes a NullPointerException crash while checking the value of site.isSingleUserSite. This PR addresses the immediate crash; however how the boolean value is getting set to null is still needs investigation.

Tested

  • New site creation sets a non-null value in the db
  • Migrating the db sets a non-null value in the db
  • gson setting false

cc: @oguzkocer

To test:

  • Install the app
  • Login and select a site
  • Navigate to MySite > More > Posts
  • ✅ Validate the post list loads as normal and the author filter functions as expected

If you want to force the null

  • Download this branch
  • Download the associated FluxC branch
  • Set FluxC to build locally within WP (local-builds.config)
  • Navigate to siteResponseToSiteModel within SiteRestClient
  • Change the following line from site.setIsSingleUserSite(from.single_user_site) to site.setIsSingleUserSite(null)
  • Build and launch the app
  • In Android Studio, Navigate to DatabaseInspector > SiteModel
  • Notice that IsSingleUserSite = null
  • In the app, navigate to MySite > More > Posts
  • ✅ Validate the post list loads as normal

Regression Notes

  1. Potential unintended areas of impact
    The posts list still crashes and the author filter does not work properly

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Add new unit test to PostListMainViewModelTest

  3. What automated tests I added (or what prevented me from doing so) N/A

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.

UI Changes testing checklist: N/A

@zwarm zwarm added this to the 23.6 ❄️ milestone Nov 2, 2023
@zwarm zwarm requested a review from AjeshRPai November 2, 2023 22:08
@zwarm zwarm self-assigned this Nov 2, 2023
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 2, 2023

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr19523-21c5e73
Commit21c5e73
Direct Downloadjetpack-prototype-build-pr19523-21c5e73.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 2, 2023

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr19523-21c5e73
Commit21c5e73
Direct Downloadwordpress-prototype-build-pr19523-21c5e73.apk
Note: Google Login is not supported on these builds.

@peril-wordpress-mobile
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 4 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

Copy link
Contributor

@AjeshRPai AjeshRPai left a comment

Choose a reason for hiding this comment

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

👍🏼 LGTM

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