Page MenuHomePhabricator

[native] introduce useUploadSelectedMedia hook
ClosedPublic

Authored by ginsu on Apr 20 2023, 12:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 22, 3:39 AM
Unknown Object (File)
Sun, Nov 10, 1:08 PM
Unknown Object (File)
Fri, Nov 8, 2:38 AM
Unknown Object (File)
Mon, Nov 4, 11:15 AM
Unknown Object (File)
Oct 27 2024, 2:36 AM
Unknown Object (File)
Oct 27 2024, 2:36 AM
Unknown Object (File)
Oct 27 2024, 2:36 AM
Unknown Object (File)
Oct 27 2024, 2:36 AM
Subscribers

Details

Summary

First step in the great avatars refactor/cleanup. Created this diff to factor out all the logic for uploading and preparing an image selection to be saved by the set avatar endpoints, which was really long and making it difficult to read/work in the avatar-hooks file.

Test Plan

Tested that I could still upload image avatar through this hook, and that the correct loading states for either user avatar or thread avatars were being changed during the image avatar creation flow

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ginsu added reviewers: ashoat, atul.
native/avatars/avatar-hooks.js
139 ↗(On Diff #25469)

This is a temporary solution until we introduce an edit avatar context/provider. Again I wanted to create this diff first this file a bit easier to read/work in.

native/avatars/avatar-hooks.js
320–326 ↗(On Diff #25469)

Completely removed this from useUploadSelectedMedia since this will always be false and is unnecessary

ashoat added inline comments.
native/avatars/avatar-hooks.js
177 ↗(On Diff #25469)

I'm not 100% sure but you might be able to do this

214–216 ↗(On Diff #25469)

I think this can be defined below updateUserAvatarLoadingStatus. It's weird defining it in between logic that is otherwise dedicated to inProgress

This revision is now accepted and ready to land.Apr 21 2023, 6:13 AM
ginsu edited the summary of this revision. (Show Details)

address comments/rebase before landing