Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3349388
D13297.id44153.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D13297.id44153.diff
View Options
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
@@ -25,6 +25,11 @@
MediaLibrarySelection,
MediaMissionFailure,
} from 'lib/types/media-types.js';
+import type {
+ RawThreadInfo,
+ ThreadInfo,
+} from 'lib/types/minimally-encoded-thread-permissions-types.js';
+import { threadTypeIsThick } from 'lib/types/thread-types-enum.js';
import { authoritativeKeyserverID } from '../authoritative-keyserver.js';
import CommIcon from '../components/comm-icon.react.js';
@@ -405,7 +410,7 @@
function useNativeUpdateThreadImageAvatar(): (
selection: NativeMediaSelection,
- threadID: string,
+ threadInfo: ThreadInfo | RawThreadInfo,
) => Promise<void> {
const editThreadAvatarContext = React.useContext(EditThreadAvatarContext);
invariant(editThreadAvatarContext, 'editThreadAvatarContext must be defined');
@@ -419,18 +424,21 @@
const nativeUpdateThreadImageAvatar = React.useCallback(
async (
selection: NativeMediaSelection,
- threadID: string,
+ threadInfo: ThreadInfo | RawThreadInfo,
): Promise<void> => {
+ const metadataUploadLocation = threadTypeIsThick(threadInfo.type)
+ ? 'none'
+ : 'keyserver';
const imageAvatarUpdateRequest = await uploadSelectedMedia(
selection,
- 'keyserver',
+ metadataUploadLocation,
);
if (!imageAvatarUpdateRequest) {
return;
}
try {
- await baseSetThreadAvatar(threadID, imageAvatarUpdateRequest);
+ await baseSetThreadAvatar(threadInfo.id, imageAvatarUpdateRequest);
} catch {
displayAvatarUpdateFailureAlert();
}
@@ -442,17 +450,17 @@
}
function useSelectFromGalleryAndUpdateThreadAvatar(): (
- threadID: string,
+ threadInfo: ThreadInfo | RawThreadInfo,
) => Promise<void> {
const nativeUpdateThreadImageAvatar = useNativeUpdateThreadImageAvatar();
const selectFromGalleryAndUpdateThreadAvatar = React.useCallback(
- async (threadID: string): Promise<void> => {
+ async (threadInfo: ThreadInfo | RawThreadInfo): Promise<void> => {
const selection: ?MediaLibrarySelection = await selectFromGallery();
if (!selection) {
return;
}
- await nativeUpdateThreadImageAvatar(selection, threadID);
+ await nativeUpdateThreadImageAvatar(selection, threadInfo);
},
[nativeUpdateThreadImageAvatar],
);
diff --git a/native/avatars/edit-thread-avatar.react.js b/native/avatars/edit-thread-avatar.react.js
--- a/native/avatars/edit-thread-avatar.react.js
+++ b/native/avatars/edit-thread-avatar.react.js
@@ -53,8 +53,8 @@
}, [navigate, threadInfo]);
const selectFromGallery = React.useCallback(
- () => selectFromGalleryAndUpdateThreadAvatar(threadInfo.id),
- [selectFromGalleryAndUpdateThreadAvatar, threadInfo.id],
+ () => selectFromGalleryAndUpdateThreadAvatar(threadInfo),
+ [selectFromGalleryAndUpdateThreadAvatar, threadInfo],
);
const navigateToCamera = React.useCallback(() => {
diff --git a/native/media/thread-avatar-camera-modal.react.js b/native/media/thread-avatar-camera-modal.react.js
--- a/native/media/thread-avatar-camera-modal.react.js
+++ b/native/media/thread-avatar-camera-modal.react.js
@@ -35,8 +35,8 @@
const sendPhoto = React.useCallback(
(capture: PhotoCapture) =>
- nativeUpdateThreadImageAvatar(capture, threadInfo.id),
- [threadInfo.id, nativeUpdateThreadImageAvatar],
+ nativeUpdateThreadImageAvatar(capture, threadInfo),
+ [threadInfo, nativeUpdateThreadImageAvatar],
);
return <CameraModal handlePhotoCapture={sendPhoto} navigation={navigation} />;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 5:47 PM (20 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2570685
Default Alt Text
D13297.id44153.diff (3 KB)
Attached To
Mode
D13297: [native] Skip keyserver upload for thick thread avatars
Attached
Detach File
Event Timeline
Log In to Comment