-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
UGC: Fix an edge case where the app could crash when blocking a post author #20421
Conversation
Generated by 🚫 dangerJS |
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to look into a way to write a unit test for this.
Fixes #20387
This PR resolves an issue where the app could crash when blocking a Post Author.
Root Cause
post.authorID
to check whether it's blocked or not.post.authorID
isNSNumber!
post.authorID
without safely unwrapping it. ( I thoughtauthorID
property would never benil
)post.authorID
could benil
I don't know how to reproduce that case, though.Solution
Safely unwrap that property before using it.
Test Instructions
I don't know how to reproduce a case where
post.authorID
isnil
but I think we should test User Blocking feature for regression.Since the code changes are minor and are unlikely to cause a regression issue, feel free to test only 1 one of the following use cases:
User Blocking Test Instructions
Regression Notes
Potential unintended areas of impact
Smoke test User Blocking feature.
What I did to test those areas of impact (or what existing automated tests I relied on)
Manual testing.
What automated tests I added (or what prevented me from doing so)
None.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.