Page MenuHomePhorge

D13155.1768512895.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D13155.1768512895.diff

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
@@ -79,7 +79,7 @@
import { unshimMessageInfos } from '../shared/unshim-utils.js';
import { updateSpecs } from '../shared/updates/update-specs.js';
import { recoveryFromReduxActionSources } from '../types/account-types.js';
-import { processDMOpsActionType } from '../types/dm-ops.js';
+import { processDMOpsActionType, sendDMActionTypes } from '../types/dm-ops.js';
import type { Media, Image } from '../types/media-types.js';
import { messageTypes } from '../types/message-types-enum.js';
import {
@@ -1856,6 +1856,51 @@
localOperation,
]),
};
+ } else if (action.type === sendDMActionTypes.success) {
+ const { messageID: sentMessageID, outboundP2PMessageIDs } = action.payload;
+
+ const localOutboundP2PMessageIDs =
+ messageStore.local[sentMessageID]?.outboundP2PMessageIDs ?? [];
+ const remainingOutboundP2PMessageIDs = localOutboundP2PMessageIDs.filter(
+ id => !outboundP2PMessageIDs.includes(id),
+ );
+
+ const localOperation: ReplaceMessageStoreLocalMessageInfoOperation = {
+ type: 'replace_local_message_info',
+ payload: {
+ id: sentMessageID,
+ localMessageInfo: {
+ sendFailed: remainingOutboundP2PMessageIDs.length > 0,
+ outboundP2PMessageIDs: remainingOutboundP2PMessageIDs,
+ },
+ },
+ };
+
+ return {
+ messageStoreOperations: [localOperation],
+ messageStore: processMessageStoreOperations(messageStore, [
+ localOperation,
+ ]),
+ };
+ } else if (action.type === sendDMActionTypes.started) {
+ const { messageID: sentMessageID } = action.payload;
+ const localOperation: ReplaceMessageStoreLocalMessageInfoOperation = {
+ type: 'replace_local_message_info',
+ payload: {
+ id: sentMessageID,
+ localMessageInfo: {
+ ...messageStore.local[sentMessageID],
+ sendFailed: false,
+ },
+ },
+ };
+
+ return {
+ messageStoreOperations: [localOperation],
+ messageStore: processMessageStoreOperations(messageStore, [
+ localOperation,
+ ]),
+ };
}
return { messageStoreOperations: [], messageStore };
}
diff --git a/lib/types/dm-ops.js b/lib/types/dm-ops.js
--- a/lib/types/dm-ops.js
+++ b/lib/types/dm-ops.js
@@ -383,3 +383,18 @@
}>,
},
};
+
+export type SendDMStartedPayload = {
+ +messageID: string,
+};
+
+export type SendDMOpsPayload = {
+ +messageID: string,
+ +outboundP2PMessageIDs: $ReadOnlyArray<string>,
+};
+
+export const sendDMActionTypes = Object.freeze({
+ started: 'SEND_DM_STARTED',
+ success: 'SEND_DM_SUCCESS',
+ failed: 'SEND_DM_FAILED',
+});
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -47,6 +47,8 @@
QueueDMOpsPayload,
PruneDMOpsQueuePayload,
ClearQueuedThreadDMOpsPayload,
+ SendDMStartedPayload,
+ SendDMOpsPayload,
} from './dm-ops.js';
import type { DraftStore } from './draft-types.js';
import type { EnabledApps, SupportedApps } from './enabled-apps.js';
@@ -1578,6 +1580,22 @@
+type: 'PROCESS_DM_OPS',
+payload: ProcessDMOpsPayload,
}
+ | {
+ +type: 'SEND_DM_STARTED',
+ +payload: SendDMStartedPayload,
+ +loadingInfo: LoadingInfo,
+ }
+ | {
+ +type: 'SEND_DM_FAILED',
+ +error: true,
+ +payload: Error,
+ +loadingInfo: LoadingInfo,
+ }
+ | {
+ +type: 'SEND_DM_SUCCESS',
+ +payload: SendDMOpsPayload,
+ +loadingInfo: LoadingInfo,
+ }
| {
+type: 'INVALIDATE_TUNNELBROKER_DEVICE_TOKEN',
+payload: {

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 15, 9:34 PM (17 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5940184
Default Alt Text
D13155.1768512895.diff (3 KB)

Event Timeline