Page MenuHomePhabricator

D13420.id44437.diff
No OneTemporary

D13420.id44437.diff

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
@@ -274,11 +274,11 @@
const pendingUploads = state.pendingUploads[threadID];
for (const localUploadID in pendingUploads) {
const upload = pendingUploads[localUploadID];
- const { messageID, serverID, failed } = upload;
+ const { messageID, canBeSent, failed } = upload;
if (!messageID || !messageID.startsWith(localIDPrefix)) {
continue;
}
- if (!serverID || failed) {
+ if (!canBeSent || failed) {
completed.set(messageID, false);
continue;
}
@@ -864,6 +864,7 @@
uri: encryptionResult?.uri ?? uri,
loop: false,
uriIsReal: false,
+ canBeSent: false,
blobHolder: null,
blobHash: encryptionResult?.sha256Hash,
encryptionKey: encryptionResult?.encryptionKey,
@@ -890,6 +891,7 @@
async uploadFile(threadInfo: ThreadInfo, upload: PendingMultimediaUpload) {
const { selectTime, localID, encryptionKey } = upload;
const threadID = threadInfo.id;
+ const isThickThread = threadTypeIsThick(threadInfo.type);
const isEncrypted =
!!encryptionKey &&
(upload.mediaType === 'encrypted_photo' ||
@@ -931,7 +933,6 @@
abortHandler: (abort: () => void) =>
this.handleAbortCallback(threadID, localID, abort),
};
- const isThickThread = threadTypeIsThick(threadInfo.type);
const useBlobService = isThickThread || this.useBlobServiceUploads;
if (
useBlobService &&
@@ -1041,6 +1042,10 @@
serverID: result.id,
blobHolder: result.blobHolder,
abort: null,
+ // For thin threads we can send message right after serverID
+ // is present, but for thick threads we need to wait until
+ // a "real" Blob URI is assigned to the message.
+ canBeSent: !isThickThread,
},
},
},
@@ -1128,8 +1133,9 @@
uri: result.uri,
mediaType: outputMediaType,
dimensions: result.dimensions,
- uriIsReal: true,
loop: result.loop,
+ uriIsReal: true,
+ canBeSent: true,
},
},
},
diff --git a/web/input/input-state.js b/web/input/input-state.js
--- a/web/input/input-state.js
+++ b/web/input/input-state.js
@@ -35,6 +35,7 @@
// URLs created with createObjectURL aren't considered "real". The distinction
// is required because those "fake" URLs must be disposed properly
+uriIsReal: boolean,
+ +canBeSent: boolean,
+progressPercent: number,
// This is set once the network request begins and used if the upload is
// cancelled

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 1, 3:29 AM (22 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2202413
Default Alt Text
D13420.id44437.diff (2 KB)

Event Timeline