-
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
Fix issue preventing users from change profile picture #18132
Conversation
This bug fix works around a Photo Library permissions by opening the album selector instead of the "self-portraits" album.
Tested using build
|
Generated by 🚫 dangerJS |
The release notes can be left out since I don't think it's essential that they go into this release 👍 |
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.
Tested the flows below. Works as described!
- Fresh install, change profile photo during account creation (sign-up)
- Fresh install, change profile photo after login
- Fresh install, add media via My Site → Media (Opens albums w recents at the top)
- Fresh install, log in, change profile photo, add media via My Site → Media
- Fresh install, log in, change profile photo, add media via image block within the block editor
- Fresh install, log in, change profile photo, change site icon (ensure it shows both media library photos and device photos)
- Without reinstalling, try any combination of the above and look out for any issues
Thank you @guarani and @momo-ozawa 🙌 I'm going to take over merging this so we can ship a new beta today. |
@guarani this has been bundled as part of 19.4 beta 2 (19.4.0.2). Thanks for your work 🙌 |
Thank you @momo-ozawa and @mokagio! |
This PR is a workaround to fix an issue where the app froze and didn't show device photos when the user attempted to set their profile photo.
It also resolves a related issue where the app was opening different albums when the user attempts to change their profile photo (now the "Recents" album will always be opened when editing profile photos).
The app was freezing (and not showing device photos) because in code, we are not requesting permissions before calling into the
PHPhotoLibrary.shared().register()
function. This function call happened when the app filtered only for "selfie" photos, so eliminating that filter worked around the bug.To fix the root cause involves calling
requestAuthorization(for:handler:)
before applying the filter. (There was recent work, see PR here, that appears to be related to this.)My plan is to create a separate
WPMediaPicker
issue and follow up on that separately, after shipping this workaround.I have no preference between the app opening the "Selfies" album or the "Recents" album, so I don't think this change has any negative consequences from a user's perspective (let me know if you think otherwise).
To test
The app should now always open the "Recents" album when changing the user's profile picture. Test each of the following scenarios and look for any issues.
Regression Notes
The media picker is used in many places within the app and all . The test cases above include all known scenarios affected by the bug as well as scenarios where I checked for regressions
I relied on manual tests as specified in the above test plan.
I don't think adding automated tests here is feasible. Unless we mocked
PHPhotoLibrary
, the test would have a large external dependency. I think there's room for a unit test inside of the WPMediaPicker library, which we might be able to do once we address the root cause of this issue in a separate PR.PR submission checklist:
RELEASE-NOTES.txt
if necessary.