Page MenuHomePhabricator

D13332.diff
No OneTemporary

D13332.diff

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
@@ -6,12 +6,10 @@
import { Platform } from 'react-native';
import { createSelector } from 'reselect';
-import type { SendMultimediaMessageInput } from 'lib/actions/message-actions.js';
import {
createLocalMessageActionType,
sendMultimediaMessageActionTypes,
sendTextMessageActionTypes,
- useSendMultimediaMessage,
} from 'lib/actions/message-actions.js';
import { queueReportsActionType } from 'lib/actions/report-actions.js';
import { useNewThinThread } from 'lib/actions/thread-actions.js';
@@ -26,7 +24,10 @@
} from 'lib/actions/upload-actions.js';
import commStaffCommunity from 'lib/facts/comm-staff-community.js';
import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
-import { useInputStateContainerSendTextMessage } from 'lib/hooks/input-state-container-hooks.js';
+import {
+ useInputStateContainerSendMultimediaMessage,
+ useInputStateContainerSendTextMessage,
+} from 'lib/hooks/input-state-container-hooks.js';
import { useNewThickThread } from 'lib/hooks/thread-hooks.js';
import type {
CallSingleKeyserverEndpointOptions,
@@ -70,11 +71,9 @@
type RawMessageInfo,
type RawMultimediaMessageInfo,
type SendMessagePayload,
- type SendMessageResult,
} from 'lib/types/message-types.js';
import type { RawImagesMessageInfo } from 'lib/types/messages/images.js';
import type { RawMediaMessageInfo } from 'lib/types/messages/media.js';
-import { getMediaMessageServerDBContentsFromMedia } from 'lib/types/messages/media.js';
import type { RawTextMessageInfo } from 'lib/types/messages/text.js';
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
import type { Dispatch } from 'lib/types/redux-types.js';
@@ -155,8 +154,10 @@
) => Promise<UploadMultimediaResult>,
+blobServiceUpload: BlobServiceUploadAction,
+sendMultimediaMessage: (
- input: SendMultimediaMessageInput,
- ) => Promise<SendMessageResult>,
+ messageInfo: RawMultimediaMessageInfo,
+ sidebarCreation: boolean,
+ isLegacy: boolean,
+ ) => Promise<SendMessagePayload>,
+sendTextMessage: (
messageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
@@ -386,23 +387,14 @@
);
const sidebarCreation =
this.pendingSidebarCreationMessageLocalIDs.has(localID);
- const mediaMessageContents = getMediaMessageServerDBContentsFromMedia(
- messageInfo.media,
- );
try {
- const result = await this.props.sendMultimediaMessage({
- threadID,
- localID,
- mediaMessageContents,
+ const result = await this.props.sendMultimediaMessage(
+ messageInfo,
sidebarCreation,
- });
+ false,
+ );
this.pendingSidebarCreationMessageLocalIDs.delete(localID);
- return {
- localID,
- serverID: result.id,
- threadID,
- time: result.time,
- };
+ return result;
} catch (e) {
const copy = cloneError(e);
copy.localID = localID;
@@ -1760,7 +1752,8 @@
const calendarQuery = useCalendarQuery();
const callUploadMultimedia = useLegacyAshoatKeyserverCall(uploadMultimedia);
const callBlobServiceUpload = useBlobServiceUpload();
- const callSendMultimediaMessage = useSendMultimediaMessage();
+ const callSendMultimediaMessage =
+ useInputStateContainerSendMultimediaMessage();
const callSendTextMessage = useInputStateContainerSendTextMessage();
const callNewThinThread = useNewThinThread();
const callNewThickThread = useNewThickThread();
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
@@ -10,12 +10,10 @@
import * as React from 'react';
import { createSelector } from 'reselect';
-import type { LegacySendMultimediaMessageInput } from 'lib/actions/message-actions.js';
import {
createLocalMessageActionType,
sendMultimediaMessageActionTypes,
sendTextMessageActionTypes,
- useLegacySendMultimediaMessage,
} from 'lib/actions/message-actions.js';
import { queueReportsActionType } from 'lib/actions/report-actions.js';
import { useNewThinThread } from 'lib/actions/thread-actions.js';
@@ -36,7 +34,10 @@
import blobService from 'lib/facts/blob-service.js';
import commStaffCommunity from 'lib/facts/comm-staff-community.js';
import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
-import { useInputStateContainerSendTextMessage } from 'lib/hooks/input-state-container-hooks.js';
+import {
+ useInputStateContainerSendMultimediaMessage,
+ useInputStateContainerSendTextMessage,
+} from 'lib/hooks/input-state-container-hooks.js';
import { useNewThickThread } from 'lib/hooks/thread-hooks.js';
import { useLegacyAshoatKeyserverCall } from 'lib/keyserver-conn/legacy-keyserver-call.js';
import { getNextLocalUploadID } from 'lib/media/media-utils.js';
@@ -71,7 +72,6 @@
type RawMessageInfo,
type RawMultimediaMessageInfo,
type SendMessagePayload,
- type SendMessageResult,
} from 'lib/types/message-types.js';
import type { RawImagesMessageInfo } from 'lib/types/messages/images.js';
import type { RawMediaMessageInfo } from 'lib/types/messages/media.js';
@@ -149,8 +149,10 @@
+blobServiceUpload: BlobServiceUploadAction,
+deleteUpload: (input: DeleteUploadInput) => Promise<void>,
+sendMultimediaMessage: (
- input: LegacySendMultimediaMessageInput,
- ) => Promise<SendMessageResult>,
+ messageInfo: RawMultimediaMessageInfo,
+ sidebarCreation: boolean,
+ isLegacy: boolean,
+ ) => Promise<SendMessagePayload>,
+sendTextMessage: (
messageInfo: RawTextMessageInfo,
threadInfo: ThreadInfo,
@@ -537,17 +539,12 @@
);
const sidebarCreation =
this.pendingSidebarCreationMessageLocalIDs.has(localID);
- const mediaIDs = [];
- for (const { id } of messageInfo.media) {
- mediaIDs.push(id);
- }
try {
- const result = await this.props.sendMultimediaMessage({
- threadID,
- localID,
- mediaIDs,
+ const result = await this.props.sendMultimediaMessage(
+ messageInfo,
sidebarCreation,
- });
+ true,
+ );
this.pendingSidebarCreationMessageLocalIDs.delete(localID);
this.setState(prevState => {
const newThreadID = this.getRealizedOrPendingThreadID(threadID);
@@ -560,7 +557,7 @@
} else if (!upload.uriIsReal) {
newUploads[localUploadID] = {
...upload,
- messageID: result.id,
+ messageID: result.serverID,
};
}
}
@@ -571,12 +568,7 @@
},
};
});
- return {
- localID,
- serverID: result.id,
- threadID,
- time: result.time,
- };
+ return result;
} catch (e) {
const copy = cloneError(e);
copy.localID = localID;
@@ -1681,7 +1673,8 @@
const callUploadMultimedia = useLegacyAshoatKeyserverCall(uploadMultimedia);
const callBlobServiceUpload = useBlobServiceUpload();
const callDeleteUpload = useDeleteUpload();
- const callSendMultimediaMessage = useLegacySendMultimediaMessage();
+ const callSendMultimediaMessage =
+ useInputStateContainerSendMultimediaMessage();
const callSendTextMessage = useInputStateContainerSendTextMessage();
const callNewThinThread = useNewThinThread();
const callNewThickThread = useNewThickThread();

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 2:19 AM (19 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2697918
Default Alt Text
D13332.diff (7 KB)

Event Timeline