Page MenuHomePhabricator

D8360.id29219.diff
No OneTemporary

D8360.id29219.diff

diff --git a/lib/components/edit-user-avatar-provider.react.js b/lib/components/edit-user-avatar-provider.react.js
--- a/lib/components/edit-user-avatar-provider.react.js
+++ b/lib/components/edit-user-avatar-provider.react.js
@@ -34,7 +34,7 @@
export type EditUserAvatarContextType = {
+setUserAvatarMediaUploadInProgress: SetState<boolean>,
+userAvatarSaveInProgress: boolean,
- +updateImageUserAvatar: (
+ +baseUpdateImageUserAvatar: (
imageAvatarUpdateRequest: ImageAvatarDBContent,
) => Promise<void>,
+baseSetUserAvatar: (avatarRequest: UpdateUserAvatarRequest) => Promise<void>,
@@ -73,7 +73,9 @@
userAvatarMediaUploadInProgress ||
updateUserAvatarLoadingStatus === 'loading';
- const updateImageUserAvatar = React.useCallback(
+ // NOTE: Do **NOT** consume `baseUpdateImageUserAvatar` directly.
+ // Use platform-specific `[web/native]UpdateImageUserAvatar` instead.
+ const baseUpdateImageUserAvatar = React.useCallback(
async (imageAvatarUpdateRequest: ImageAvatarDBContent) => {
const promise = (async () => {
setUserAvatarMediaUploadInProgress(false);
@@ -85,7 +87,7 @@
[dispatchActionPromise, updateUserAvatarCall],
);
- // NOTE: Do NOT consume `baseSetUserAvatar` directly.
+ // NOTE: Do **NOT** consume `baseSetUserAvatar` directly.
// Use platform-specific `[web/native]SetUserAvatar` instead.
const baseSetUserAvatar = React.useCallback(
async (request: UpdateUserAvatarRequest) => {
@@ -115,7 +117,7 @@
() => ({
setUserAvatarMediaUploadInProgress,
userAvatarSaveInProgress,
- updateImageUserAvatar,
+ baseUpdateImageUserAvatar,
baseSetUserAvatar,
setRegistrationMode,
getRegistrationModeEnabled,
@@ -124,7 +126,7 @@
[
setUserAvatarMediaUploadInProgress,
userAvatarSaveInProgress,
- updateImageUserAvatar,
+ baseUpdateImageUserAvatar,
baseSetUserAvatar,
setRegistrationMode,
getRegistrationModeEnabled,
diff --git a/native/avatars/avatar-hooks.js b/native/avatars/avatar-hooks.js
--- a/native/avatars/avatar-hooks.js
+++ b/native/avatars/avatar-hooks.js
@@ -244,7 +244,7 @@
const editUserAvatarContext = React.useContext(EditUserAvatarContext);
invariant(editUserAvatarContext, 'editUserAvatarContext must be defined');
const {
- updateImageUserAvatar,
+ baseUpdateImageUserAvatar,
getRegistrationModeEnabled,
getRegistrationModeSuccessCallback,
setUserAvatarMediaUploadInProgress,
@@ -276,7 +276,7 @@
}
try {
- await updateImageUserAvatar(imageAvatarUpdateRequest);
+ await baseUpdateImageUserAvatar(imageAvatarUpdateRequest);
} catch {
displayAvatarUpdateFailureAlert();
}
@@ -284,7 +284,7 @@
[
getRegistrationModeEnabled,
getRegistrationModeSuccessCallback,
- updateImageUserAvatar,
+ baseUpdateImageUserAvatar,
uploadSelectedMedia,
],
);

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 12:33 AM (20 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2696024
Default Alt Text
D8360.id29219.diff (2 KB)

Event Timeline