Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3514367
D13555.id44743.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D13555.id44743.diff
View Options
diff --git a/lib/hooks/input-state-container-hooks.js b/lib/hooks/input-state-container-hooks.js
--- a/lib/hooks/input-state-container-hooks.js
+++ b/lib/hooks/input-state-container-hooks.js
@@ -48,6 +48,13 @@
} from '../utils/blob-service.js';
import { useSelector, useDispatch } from '../utils/redux-utils.js';
+type MediaIDUpdatePayload = { +id: string, +thumbnailID?: string };
+type MediaIDUpdates = { +[string]: MediaIDUpdatePayload };
+export type SendMultimediaMessagePayload = {
+ +result: SendMessagePayload,
+ +mediaIDUpdates?: MediaIDUpdates,
+};
+
function useInputStateContainerSendTextMessage(): (
messageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
@@ -134,7 +141,7 @@
messageInfo: RawMultimediaMessageInfo,
sidebarCreation: boolean,
isLegacy: boolean,
-) => Promise<SendMessagePayload> {
+) => Promise<SendMultimediaMessagePayload> {
const sendMultimediaMessage = useSendMultimediaMessage();
const legacySendMultimediaMessage = useLegacySendMultimediaMessage();
const sendComposableDMOperation = useSendComposableDMOperation();
@@ -160,12 +167,13 @@
const isThickThread = threadInfo && threadTypeIsThick(threadInfo.type);
if (!isThickThread && isLegacy) {
- const { messageMedia } = await migrateMessageMediaToKeyserver(
- messageInfo,
- reassignThickThreadMedia,
- dispatch,
- processHolders,
- );
+ const { messageMedia, mediaIDUpdates } =
+ await migrateMessageMediaToKeyserver(
+ messageInfo,
+ reassignThickThreadMedia,
+ dispatch,
+ processHolders,
+ );
const mediaIDs = [];
for (const { id } of messageMedia) {
mediaIDs.push(id);
@@ -177,20 +185,24 @@
sidebarCreation,
});
return {
- localID,
- serverID: result.id,
- threadID: messageInfo.threadID,
- time: result.time,
+ result: {
+ localID,
+ serverID: result.id,
+ threadID: messageInfo.threadID,
+ time: result.time,
+ },
+ mediaIDUpdates,
};
}
if (!isThickThread && !isLegacy) {
- const { messageMedia } = await migrateMessageMediaToKeyserver(
- messageInfo,
- reassignThickThreadMedia,
- dispatch,
- processHolders,
- );
+ const { messageMedia, mediaIDUpdates } =
+ await migrateMessageMediaToKeyserver(
+ messageInfo,
+ reassignThickThreadMedia,
+ dispatch,
+ processHolders,
+ );
const mediaMessageContents =
getMediaMessageServerDBContentsFromMedia(messageMedia);
const result = await sendMultimediaMessage({
@@ -200,10 +212,13 @@
sidebarCreation,
});
return {
- localID,
- serverID: result.id,
- threadID: messageInfo.threadID,
- time: result.time,
+ result: {
+ localID,
+ serverID: result.id,
+ threadID: messageInfo.threadID,
+ time: result.time,
+ },
+ mediaIDUpdates,
};
}
@@ -238,10 +253,12 @@
throw e;
}
return {
- localID,
- serverID: messageID,
- threadID: messageInfo.threadID,
- time,
+ result: {
+ localID,
+ serverID: messageID,
+ threadID: messageInfo.threadID,
+ time,
+ },
};
},
[
@@ -260,9 +277,6 @@
return mediaID.indexOf('|') !== -1;
}
-type MediaIDUpdatePayload = { +id: string, +thumbnailID?: string };
-type MediaIDUpdates = { +[string]: MediaIDUpdatePayload };
-
async function migrateMessageMediaToKeyserver(
messageInfo: RawMultimediaMessageInfo,
reassignMediaMetadata: MediaMetadataReassignmentAction,
diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js
--- a/native/input/input-state-container.react.js
+++ b/native/input/input-state-container.react.js
@@ -25,6 +25,7 @@
import commStaffCommunity from 'lib/facts/comm-staff-community.js';
import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
import {
+ type SendMultimediaMessagePayload,
useInputStateContainerSendMultimediaMessage,
useInputStateContainerSendTextMessage,
} from 'lib/hooks/input-state-container-hooks.js';
@@ -159,7 +160,7 @@
messageInfo: RawMultimediaMessageInfo,
sidebarCreation: boolean,
isLegacy: boolean,
- ) => Promise<SendMessagePayload>,
+ ) => Promise<SendMultimediaMessagePayload>,
+sendTextMessage: (
messageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
@@ -398,7 +399,7 @@
const sidebarCreation =
this.pendingSidebarCreationMessageLocalIDs.has(localID);
try {
- const result = await this.props.sendMultimediaMessage(
+ const { result } = await this.props.sendMultimediaMessage(
messageInfo,
sidebarCreation,
false,
diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js
--- a/web/input/input-state-container.react.js
+++ b/web/input/input-state-container.react.js
@@ -35,6 +35,7 @@
import commStaffCommunity from 'lib/facts/comm-staff-community.js';
import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
import {
+ type SendMultimediaMessagePayload,
useInputStateContainerSendMultimediaMessage,
useInputStateContainerSendTextMessage,
} from 'lib/hooks/input-state-container-hooks.js';
@@ -154,7 +155,7 @@
messageInfo: RawMultimediaMessageInfo,
sidebarCreation: boolean,
isLegacy: boolean,
- ) => Promise<SendMessagePayload>,
+ ) => Promise<SendMultimediaMessagePayload>,
+sendTextMessage: (
messageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
@@ -553,7 +554,7 @@
const sidebarCreation =
this.pendingSidebarCreationMessageLocalIDs.has(localID);
try {
- const result = await this.props.sendMultimediaMessage(
+ const { result } = await this.props.sendMultimediaMessage(
messageInfo,
sidebarCreation,
true,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 4:31 AM (15 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693553
Default Alt Text
D13555.id44743.diff (6 KB)
Attached To
Mode
D13555: [lib] Return mediaID updates from useSendMultimediaMessage
Attached
Detach File
Event Timeline
Log In to Comment