Page MenuHomePhabricator

D8759.diff
No OneTemporary

D8759.diff

diff --git a/lib/components/base-edit-thread-avatar-provider.react.js b/lib/components/base-edit-thread-avatar-provider.react.js
--- a/lib/components/base-edit-thread-avatar-provider.react.js
+++ b/lib/components/base-edit-thread-avatar-provider.react.js
@@ -26,7 +26,7 @@
selection: NativeMediaSelection,
threadID: string,
) => Promise<void>,
- +setThreadAvatar: (
+ +baseSetThreadAvatar: (
threadID: string,
avatarRequest: UpdateUserAvatarRequest,
) => Promise<void>,
@@ -113,7 +113,9 @@
],
);
- const setThreadAvatar = React.useCallback(
+ // NOTE: Do NOT consume `baseSetThreadAvatar` directly.
+ // Use platform-specific `[web/native]SetThreadAvatar` instead.
+ const baseSetThreadAvatar = React.useCallback(
async (threadID: string, avatarRequest: UpdateUserAvatarRequest) => {
const updateThreadRequest: UpdateThreadRequest = {
threadID,
@@ -135,9 +137,9 @@
() => ({
threadAvatarSaveInProgress,
updateImageThreadAvatar,
- setThreadAvatar,
+ baseSetThreadAvatar,
}),
- [threadAvatarSaveInProgress, updateImageThreadAvatar, setThreadAvatar],
+ [threadAvatarSaveInProgress, updateImageThreadAvatar, baseSetThreadAvatar],
);
return (
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
@@ -314,7 +314,7 @@
) => Promise<void> {
const editThreadAvatarContext = React.useContext(EditThreadAvatarContext);
invariant(editThreadAvatarContext, 'editThreadAvatarContext must be defined');
- const { setThreadAvatar } = editThreadAvatarContext;
+ const { baseSetThreadAvatar } = editThreadAvatarContext;
const nativeSetThreadAvatar = React.useCallback(
async (
@@ -322,13 +322,13 @@
avatarRequest: UpdateUserAvatarRequest,
): Promise<void> => {
try {
- await setThreadAvatar(threadID, avatarRequest);
+ await baseSetThreadAvatar(threadID, avatarRequest);
} catch (e) {
displayAvatarUpdateFailureAlert();
throw e;
}
},
- [setThreadAvatar],
+ [baseSetThreadAvatar],
);
return nativeSetThreadAvatar;

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 4:19 AM (21 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2513170
Default Alt Text
D8759.diff (2 KB)

Event Timeline