Page MenuHomePhabricator

D13555.id44743.diff
No OneTemporary

D13555.id44743.diff

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

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)

Event Timeline