Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32318051
D13330.1765299388.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
12 KB
Referenced Files
None
Subscribers
None
D13330.1765299388.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
@@ -80,7 +80,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, sendDMActionTypes } from '../types/dm-ops.js';
+import { processDMOpsActionType } from '../types/dm-ops.js';
import type { Media, Image } from '../types/media-types.js';
import { messageTypes } from '../types/message-types-enum.js';
import {
@@ -1937,63 +1937,6 @@
localOperation,
]),
};
- } else if (action.type === sendDMActionTypes.success) {
- const { messageID: sentMessageID, outboundP2PMessageIDs } = action.payload;
-
- const outboundP2PMessageIDsSet = new Set(outboundP2PMessageIDs);
- const localOutboundP2PMessageIDs =
- messageStore.local[sentMessageID]?.outboundP2PMessageIDs ?? [];
- const remainingOutboundP2PMessageIDs = localOutboundP2PMessageIDs.filter(
- id => !outboundP2PMessageIDsSet.has(id),
- );
-
- const messageStoreOperations: Array<MessageStoreOperation> = [];
- if (remainingOutboundP2PMessageIDs.length > 0) {
- messageStoreOperations.push({
- type: 'replace_local_message_info',
- payload: {
- id: sentMessageID,
- localMessageInfo: {
- sendFailed: true,
- outboundP2PMessageIDs: remainingOutboundP2PMessageIDs,
- },
- },
- });
- } else {
- messageStoreOperations.push({
- type: 'remove_local_message_infos',
- payload: {
- ids: [sentMessageID],
- },
- });
- }
-
- return {
- messageStoreOperations,
- messageStore: processMessageStoreOperations(
- messageStore,
- messageStoreOperations,
- ),
- };
- } 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/shared/dm-ops/process-dm-ops.js b/lib/shared/dm-ops/process-dm-ops.js
--- a/lib/shared/dm-ops/process-dm-ops.js
+++ b/lib/shared/dm-ops/process-dm-ops.js
@@ -24,18 +24,14 @@
import {
processDMOpsActionType,
queueDMOpsActionType,
- sendDMActionTypes,
- type SendDMOpsSuccessPayload,
+ dmOperationValidator,
} from '../../types/dm-ops.js';
-import { dmOperationValidator } from '../../types/dm-ops.js';
-import type { LocalMessageInfo } from '../../types/message-types.js';
import type { RawThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js';
import type { DispatchMetadata } from '../../types/redux-types.js';
import type { OutboundP2PMessage } from '../../types/sqlite-types.js';
import type { LegacyRawThreadInfo } from '../../types/thread-types.js';
import { updateTypes } from '../../types/update-types-enum.js';
import { extractUserIDsFromPayload } from '../../utils/conversion-utils.js';
-import { useDispatchActionPromise } from '../../utils/redux-promise-utils.js';
import { useSelector, useDispatch } from '../../utils/redux-utils.js';
import { messageSpecs } from '../messages/message-specs.js';
import { updateSpecs } from '../updates/update-specs.js';
@@ -312,69 +308,15 @@
dmOperationSpecification: OutboundDMOperationSpecification,
) => Promise<void> {
const processDMOps = useProcessDMOperation();
- const dispatchActionPromise = useDispatchActionPromise();
const { getDMOpsSendingPromise } = usePeerToPeerCommunication();
return React.useCallback(
async (dmOperationSpecification: OutboundDMOperationSpecification) => {
const { promise, dmOpID } = getDMOpsSendingPromise();
await processDMOps(dmOperationSpecification, dmOpID);
-
- if (
- dmOperationSpecification.type ===
- dmOperationSpecificationTypes.OUTBOUND &&
- !dmOpSpecs[dmOperationSpecification.op.type].supportsAutoRetry &&
- dmOperationSpecification.op.messageID
- ) {
- const messageID: string = dmOperationSpecification.op.messageID;
-
- const sendingPromise: Promise<SendDMOpsSuccessPayload> = (async () => {
- const outboundP2PMessageIDs = await promise;
- return {
- messageID,
- outboundP2PMessageIDs,
- };
- })();
-
- void dispatchActionPromise(
- sendDMActionTypes,
- sendingPromise,
- undefined,
- {
- messageID,
- },
- );
- }
- },
- [dispatchActionPromise, getDMOpsSendingPromise, processDMOps],
- );
-}
-
-function useRetrySendDMOperation(): (
- messageID: string,
- localMessageInfo: LocalMessageInfo,
-) => Promise<void> {
- const { processOutboundMessages, getDMOpsSendingPromise } =
- usePeerToPeerCommunication();
- const dispatchActionPromise = useDispatchActionPromise();
-
- return React.useCallback(
- async (messageID: string, localMessageInfo: LocalMessageInfo) => {
- const { promise, dmOpID } = getDMOpsSendingPromise();
- processOutboundMessages(localMessageInfo.outboundP2PMessageIDs, dmOpID);
-
- const sendingPromise: Promise<SendDMOpsSuccessPayload> = (async () => {
- const outboundP2PMessageIDs = await promise;
- return {
- messageID,
- outboundP2PMessageIDs,
- };
- })();
- void dispatchActionPromise(sendDMActionTypes, sendingPromise, undefined, {
- messageID,
- });
+ await promise;
},
- [dispatchActionPromise, getDMOpsSendingPromise, processOutboundMessages],
+ [getDMOpsSendingPromise, processDMOps],
);
}
@@ -440,6 +382,5 @@
export {
useProcessDMOperation,
useProcessAndSendDMOperation,
- useRetrySendDMOperation,
useSendComposableDMOperation,
};
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
@@ -447,18 +447,3 @@
}>,
},
};
-
-export type SendDMStartedPayload = {
- +messageID: string,
-};
-
-export type SendDMOpsSuccessPayload = {
- +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,8 +47,6 @@
QueueDMOpsPayload,
PruneDMOpsQueuePayload,
ClearQueuedThreadDMOpsPayload,
- SendDMStartedPayload,
- SendDMOpsSuccessPayload,
} from './dm-ops.js';
import type { DraftStore } from './draft-types.js';
import type { EnabledApps, SupportedApps } from './enabled-apps.js';
@@ -1582,22 +1580,6 @@
+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: SendDMOpsSuccessPayload,
- +loadingInfo: LoadingInfo,
- }
| {
+type: 'INVALIDATE_TUNNELBROKER_DEVICE_TOKEN',
+payload: {
diff --git a/native/chat/failed-send.react.js b/native/chat/failed-send.react.js
--- a/native/chat/failed-send.react.js
+++ b/native/chat/failed-send.react.js
@@ -5,16 +5,13 @@
import { Text, View } from 'react-native';
import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
-import { useRetrySendDMOperation } from 'lib/shared/dm-ops/process-dm-ops.js';
import { messageID } from 'lib/shared/message-utils.js';
import { messageTypes } from 'lib/types/message-types-enum.js';
import {
type RawComposableMessageInfo,
assertComposableRawMessage,
- type LocalMessageInfo,
} from 'lib/types/message-types.js';
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
-import { threadTypeIsThick } from 'lib/types/thread-types-enum.js';
import { multimediaMessageSendFailed } from './multimedia-message-utils.js';
import textMessageSendFailed from './text-message-send-failed.js';
@@ -52,10 +49,6 @@
+styles: $ReadOnly<typeof unboundStyles>,
+inputState: ?InputState,
+parentThreadInfo: ?ThreadInfo,
- +retrySendDMOperation: (
- messageID: string,
- localMessageInfo: LocalMessageInfo,
- ) => Promise<void>,
};
class FailedSend extends React.PureComponent<Props> {
retryingText = false;
@@ -144,18 +137,6 @@
this.retryingMedia = true;
}
- if (threadTypeIsThick(this.props.item.threadInfo.type)) {
- const failedMessageID = this.props.rawMessageInfo?.id;
- invariant(failedMessageID, 'failedMessageID should be set for DMs');
- const localMessageInfo = this.props.item.localMessageInfo;
- invariant(
- localMessageInfo,
- 'localMessageInfo should be set for failed message',
- );
- void this.props.retrySendDMOperation(failedMessageID, localMessageInfo);
- return;
- }
-
const { inputState } = this.props;
invariant(
inputState,
@@ -184,7 +165,6 @@
const parentThreadInfo = useSelector(state =>
parentThreadID ? threadInfoSelector(state)[parentThreadID] : null,
);
- const retrySendDMOperation = useRetrySendDMOperation();
return (
<FailedSend
@@ -193,7 +173,6 @@
styles={styles}
inputState={inputState}
parentThreadInfo={parentThreadInfo}
- retrySendDMOperation={retrySendDMOperation}
/>
);
});
diff --git a/web/chat/failed-send.react.js b/web/chat/failed-send.react.js
--- a/web/chat/failed-send.react.js
+++ b/web/chat/failed-send.react.js
@@ -5,16 +5,13 @@
import { type ChatMessageInfoItem } from 'lib/selectors/chat-selectors.js';
import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
-import { useRetrySendDMOperation } from 'lib/shared/dm-ops/process-dm-ops.js';
import { messageID } from 'lib/shared/message-utils.js';
import { messageTypes } from 'lib/types/message-types-enum.js';
import {
assertComposableMessageType,
- type LocalMessageInfo,
type RawComposableMessageInfo,
} from 'lib/types/message-types.js';
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
-import { threadTypeIsThick } from 'lib/types/thread-types-enum.js';
import css from './chat-message-list.css';
import multimediaMessageSendFailed from './multimedia-message-send-failed.js';
@@ -32,10 +29,6 @@
+rawMessageInfo: RawComposableMessageInfo,
+inputState: ?InputState,
+parentThreadInfo: ?ThreadInfo,
- +retrySendDMOperation: (
- messageID: string,
- localMessageInfo: LocalMessageInfo,
- ) => Promise<void>,
};
class FailedSend extends React.PureComponent<Props> {
retryingText = false;
@@ -113,17 +106,6 @@
return;
}
this.retryingText = true;
- if (threadTypeIsThick(this.props.threadInfo.type)) {
- const failedMessageID = this.props.rawMessageInfo.id;
- invariant(failedMessageID, 'failedMessageID should be set for DMs');
- const localMessageInfo = this.props.item.localMessageInfo;
- invariant(
- localMessageInfo,
- 'localMessageInfo should be set for failed message',
- );
- void this.props.retrySendDMOperation(failedMessageID, localMessageInfo);
- return;
- }
void inputState.sendTextMessage(
{
...rawMessageInfo,
@@ -167,7 +149,6 @@
const parentThreadInfo = useSelector(state =>
parentThreadID ? threadInfoSelector(state)[parentThreadID] : null,
);
- const retrySendDMOperation = useRetrySendDMOperation();
return (
<FailedSend
@@ -175,7 +156,6 @@
rawMessageInfo={rawMessageInfo}
inputState={inputState}
parentThreadInfo={parentThreadInfo}
- retrySendDMOperation={retrySendDMOperation}
/>
);
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 9, 4:56 PM (7 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5855757
Default Alt Text
D13330.1765299388.diff (12 KB)
Attached To
Mode
D13330: [web][native][lib] deprecate `sendDMActionTypes` and simplify hooks
Attached
Detach File
Event Timeline
Log In to Comment