Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3367380
D13153.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13153.diff
View Options
diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js
--- a/lib/reducers/message-reducer.js
+++ b/lib/reducers/message-reducer.js
@@ -1660,6 +1660,31 @@
const actionPayloadMessageStoreLocalMessageInfos =
action.payload.messageStoreLocalMessageInfos ?? {};
+ const messageStoreOperations: Array<MessageStoreOperation> = [];
+
+ for (const localMessageID in actionPayloadMessageStoreLocalMessageInfos) {
+ if (
+ actionPayloadMessageStoreLocalMessageInfos[localMessageID]
+ .outboundP2PMessages &&
+ actionPayloadMessageStoreLocalMessageInfos[localMessageID]
+ .outboundP2PMessages.length > 0
+ ) {
+ // If there are `outboundP2PMessages` it means the message failed,
+ // but setting `sendFailed` could not be done, e.g. when the app was
+ // killed in the process of sending messages.
+ messageStoreOperations.push({
+ type: 'replace_local_message_info',
+ payload: {
+ id: localMessageID,
+ localMessageInfo: {
+ ...actionPayloadMessageStoreLocalMessageInfos[localMessageID],
+ sendFailed: true,
+ },
+ },
+ });
+ }
+ }
+
const newThreads: {
[threadID: string]: ThreadMessageInfo,
} = { ...messageStore.threads };
@@ -1682,16 +1707,18 @@
};
}
- const { messageStoreOperations, messageStore: updatedMessageStore } =
- updateMessageStoreWithLatestThreadInfos(
- {
- ...messageStore,
- threads: newThreads,
- local: actionPayloadMessageStoreLocalMessageInfos,
- },
- newThreadInfos,
- );
-
+ const {
+ messageStoreOperations: updatedMessageStoreOperations,
+ messageStore: updatedMessageStore,
+ } = updateMessageStoreWithLatestThreadInfos(
+ {
+ ...messageStore,
+ threads: newThreads,
+ local: actionPayloadMessageStoreLocalMessageInfos,
+ },
+ newThreadInfos,
+ );
+ messageStoreOperations.push(...updatedMessageStoreOperations);
let threads = { ...updatedMessageStore.threads };
let local = { ...updatedMessageStore.local };
diff --git a/lib/types/message-types.js b/lib/types/message-types.js
--- a/lib/types/message-types.js
+++ b/lib/types/message-types.js
@@ -439,8 +439,12 @@
// Tracks client-local information about a message that hasn't been assigned an
// ID by the server yet. As soon as the client gets an ack from the server for
// this message, it will clear the LocalMessageInfo.
+// For DMs, it keeps track of P2P Messages that are not yet sent.
+// As soon as messages are queued on Tunnelbroker, it will
+// clear the LocalMessageInfo.
export type LocalMessageInfo = {
+sendFailed?: boolean,
+ +outboundP2PMessageIDs?: $ReadOnlyArray<string>,
};
const localMessageInfoValidator: TInterface<LocalMessageInfo> =
tShape<LocalMessageInfo>({
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 2:42 PM (21 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585153
Default Alt Text
D13153.diff (2 KB)
Attached To
Mode
D13153: [lib] add `outboundP2PMessageIDs` to `LocalMessageInfo` to track progress
Attached
Detach File
Event Timeline
Log In to Comment