Skip to content

Commit

Permalink
[web] Call baseSetUserAvatar from onImageSelected
Browse files Browse the repository at this point in the history
Summary:
Once image is successfully uploaded, we make call to `baseSetUserAvatar` from `EditUserAvatarContext`.

As of this diff, users can set emoji, image, ENS avatars (and remove them). What's missing is `ImageAvatarSelectionModal` to handle cropping + some error handling. Those will be handled after the thread avatar work.

---

Depends on D8725

Test Plan:
Works as expected:

{F674875}

Reviewers: ashoat, ginsu

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D8726
  • Loading branch information
atulsmadhugiri committed Aug 4, 2023
1 parent 4c9e85a commit cf12040
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions web/avatars/edit-user-avatar-menu.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ function EditUserAvatarMenu(): React.Node {

const uploadAvatarMedia = useUploadAvatarMedia();
const onImageSelected = React.useCallback(
event => uploadAvatarMedia(event.target.files[0]),
[uploadAvatarMedia],
async event => {
const uploadResult = await uploadAvatarMedia(event.target.files[0]);
baseSetUserAvatar({ type: 'image', uploadID: uploadResult.id });
},
[baseSetUserAvatar, uploadAvatarMedia],
);

const imageMenuItem = React.useMemo(
Expand Down

0 comments on commit cf12040

Please sign in to comment.