-
Notifications
You must be signed in to change notification settings - Fork 3.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
Refactor User_UploadAvatar
(front-end)
#10235
Conversation
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.
Code changes look good, a few tiny comments - haven't tested yet (will test after you do & you add a few screenshots plz :D)
@Beamanator Will do!
This is out of date! We're going to merge the Web PR first and test with it once it's been deployed. |
Sounds good man! Oof good luck with VPN and ngrok :'( I don't thinkkk you need the VPN for App dev though, do you? I don't think I've needed it, I rarely rarely turn the VPN on (since it's annoying from where I'm located) |
@Beamanator based on my comment here let's get the Web PR deployed first, that way I'll be able to test the front-end changes with working s3 buckets. |
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.
Some more tiny comments
@Beamanator addressed your comments! I removed the |
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.
@Beamanator hmmm I can't reproduce, the button never becomes clickable for me: Here's the condition we're using to decide whether the button should be disabled. Looking around in ProfilePage.js I can't see how the button would become enabled by uploading the avatar.
|
Hmm something that seems not ideal, let me know if you agree @jasperhuangg (maybe can be handled in future issue):
|
EDIT: steps 1-3 are necessary I just technically already performed them. |
@Beamanator figured it out, it's because we're not clearing pendingFields in the successData, so the next time you go offline pendingField.avatar is still |
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 looks like removing the workspace avatar isn't working - when I refresh the page (hard refresh)
@Beamanator |
aaah good catch @jasperhuangg - I guess we need to get that fix CP'd before merging this right? |
User_UploadAvatar
(front-end)User_UploadAvatar
(front-end)
Yup! HOLDing this PR on https://github.com/Expensify/Web-Expensify/pull/34724 for now. |
@jasperhuangg merged! let's get it CP'd! :D |
User_UploadAvatar
(front-end)User_UploadAvatar
(front-end)
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.
After a few rounds of testing everything's looking great!
🚀 Deployed to staging by @Beamanator in version: 1.1.94-3 🚀
|
Details
Since we changed
UserAPI::uploadAvatar
to return anavatar
andavatarThumbnail
here, we need to change how they are accessed in NewDot once the API call returns.This also standardizes any accessing of avatars with
avatar
for the high resolution image andavatarThumbnail
for the low resolution image. For personal details, we use both high and low resolution images. For policies, we only use the high resolution image. For more information, see my comment here.Finally, this also updates avatar picker on the profile page and workspace settings page to be offline first, and use the new API commands.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/214156
Tests
Update your
.env
file to use the production API by following this SO. This needs to be done since our s3 bucket uploads only work in prod.Sign into any account and open your Profile Settings (click on your avatar > Profile).
Click on the avatar picker and upload an avatar. Verify that no loading indicator appears, and that your avatar updates immediately after you click "Save" (the "Save" button in the cropping modal). Hard refresh (

<Command><Shift><R>
) the page, and verify that the new avatar is persisted.Be ready to turn off your device wifi very quickly. Repeat step 3, but IMMEDIATELY turn off your device wifi before the avatar can finish uploading. It should still show the new avatar, but it should be greyed out like so:

Turn your device wifi back on, and verify the upload completes and the avatar isn't greyed out anymore.
Now click on the avatar picker again and select "Remove photo". Verify that the avatar is replaced with a default avatar. Reload the page and verify that this is persisted.
To test the error displaying, run the following code-snippet in the JS console, and verify it displays correctly:
Now repeat steps 3-6, but with the avatar picker in the Workspace Settings page.
PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
Same as the testing steps, except you can skip step 1 and 7.
Screenshots
Web
Mobile Web
Desktop
iOS
Android