Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3517917
D8344.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D8344.diff
View Options
diff --git a/lib/components/base-edit-user-avatar-provider.react.js b/lib/components/base-edit-user-avatar-provider.react.js
--- a/lib/components/base-edit-user-avatar-provider.react.js
+++ b/lib/components/base-edit-user-avatar-provider.react.js
@@ -33,7 +33,7 @@
export type EditUserAvatarContextType = {
+userAvatarSaveInProgress: boolean,
+updateImageUserAvatar: (selection: NativeMediaSelection) => Promise<void>,
- +setUserAvatar: (avatarRequest: UpdateUserAvatarRequest) => Promise<void>,
+ +baseSetUserAvatar: (avatarRequest: UpdateUserAvatarRequest) => Promise<void>,
+setRegistrationMode: (registrationMode: RegistrationMode) => void,
+getRegistrationModeEnabled: () => boolean,
+getRegistrationModeSuccessCallback: () => ?(UserAvatarSelection) => mixed,
@@ -101,7 +101,9 @@
[uploadSelectedMedia, dispatchActionPromise, updateUserAvatarCall],
);
- const setUserAvatar = React.useCallback(
+ // NOTE: Do NOT consume `baseSetUserAvatar` directly.
+ // Use platform-specific `[web/native]SetUserAvatar` instead.
+ const baseSetUserAvatar = React.useCallback(
async (request: UpdateUserAvatarRequest) => {
const promise = updateUserAvatarCall(request);
dispatchActionPromise(updateUserAvatarActionTypes, promise);
@@ -129,7 +131,7 @@
() => ({
userAvatarSaveInProgress,
updateImageUserAvatar,
- setUserAvatar,
+ baseSetUserAvatar,
setRegistrationMode,
getRegistrationModeEnabled,
getRegistrationModeSuccessCallback,
@@ -137,7 +139,7 @@
[
userAvatarSaveInProgress,
updateImageUserAvatar,
- setUserAvatar,
+ baseSetUserAvatar,
setRegistrationMode,
getRegistrationModeEnabled,
getRegistrationModeSuccessCallback,
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
@@ -201,7 +201,7 @@
const editUserAvatarContext = React.useContext(EditUserAvatarContext);
invariant(editUserAvatarContext, 'editUserAvatarContext must be defined');
const {
- setUserAvatar,
+ baseSetUserAvatar,
getRegistrationModeEnabled,
getRegistrationModeSuccessCallback,
} = editUserAvatarContext;
@@ -223,7 +223,7 @@
}
try {
- await setUserAvatar(request);
+ await baseSetUserAvatar(request);
} catch {
displayAvatarUpdateFailureAlert();
}
@@ -231,7 +231,7 @@
[
getRegistrationModeEnabled,
getRegistrationModeSuccessCallback,
- setUserAvatar,
+ baseSetUserAvatar,
],
);
diff --git a/web/avatars/edit-user-avatar-menu.react.js b/web/avatars/edit-user-avatar-menu.react.js
--- a/web/avatars/edit-user-avatar-menu.react.js
+++ b/web/avatars/edit-user-avatar-menu.react.js
@@ -23,11 +23,11 @@
const editUserAvatarContext = React.useContext(EditUserAvatarContext);
invariant(editUserAvatarContext, 'editUserAvatarContext should be set');
- const { setUserAvatar } = editUserAvatarContext;
+ const { baseSetUserAvatar } = editUserAvatarContext;
const removeUserAvatar = React.useCallback(
- () => setUserAvatar({ type: 'remove' }),
- [setUserAvatar],
+ () => baseSetUserAvatar({ type: 'remove' }),
+ [baseSetUserAvatar],
);
const { pushModal } = useModalContext();
diff --git a/web/avatars/emoji-avatar-selection-modal.react.js b/web/avatars/emoji-avatar-selection-modal.react.js
--- a/web/avatars/emoji-avatar-selection-modal.react.js
+++ b/web/avatars/emoji-avatar-selection-modal.react.js
@@ -35,7 +35,7 @@
const editUserAvatarContext = React.useContext(EditUserAvatarContext);
invariant(editUserAvatarContext, 'editUserAvatarContext should be set');
- const { setUserAvatar, userAvatarSaveInProgress } = editUserAvatarContext;
+ const { baseSetUserAvatar, userAvatarSaveInProgress } = editUserAvatarContext;
const [updateAvatarStatus, setUpdateAvatarStatus] =
React.useState<?('success' | 'failure')>();
@@ -80,12 +80,12 @@
const onSaveAvatar = React.useCallback(async () => {
try {
- await setUserAvatar(pendingEmojiAvatar);
+ await baseSetUserAvatar(pendingEmojiAvatar);
setUpdateAvatarStatus('success');
} catch {
setUpdateAvatarStatus('failure');
}
- }, [pendingEmojiAvatar, setUserAvatar]);
+ }, [pendingEmojiAvatar, baseSetUserAvatar]);
let saveButtonContent;
let buttonColor;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 6:36 PM (18 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2695828
Default Alt Text
D8344.diff (4 KB)
Attached To
Mode
D8344: [lib] Rename `setUserAvatar` to `baseSetUserAvatar` in `*EditUserAvatarProvider`
Attached
Detach File
Event Timeline
Log In to Comment