Page MenuHomePhabricator

D13740.id45244.diff
No OneTemporary

D13740.id45244.diff

diff --git a/lib/reducers/aux-user-reducer.js b/lib/reducers/aux-user-reducer.js
--- a/lib/reducers/aux-user-reducer.js
+++ b/lib/reducers/aux-user-reducer.js
@@ -223,10 +223,11 @@
auxUserStoreOperations: removeUsersOps,
};
} else if (action.type === removePeerUsersActionType) {
+ const userIDs = action.payload.updates.map(update => update.deletedUserID);
const removeUsersOps: RemoveAuxUserInfosOperation[] = [
{
type: 'remove_aux_user_infos',
- payload: { ids: action.payload.userIDs },
+ payload: { ids: userIDs },
},
];
diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js
--- a/lib/reducers/thread-reducer.js
+++ b/lib/reducers/thread-reducer.js
@@ -4,6 +4,7 @@
setThreadUnreadStatusActionTypes,
updateActivityActionTypes,
} from '../actions/activity-actions.js';
+import { removePeerUsersActionType } from '../actions/aux-user-actions.js';
import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js';
import { saveMessagesActionType } from '../actions/message-actions.js';
import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js';
@@ -604,6 +605,23 @@
newThreadInconsistencies: [],
threadStoreOperations: threadStoreOperationsWithNewMessagesUpdates,
};
+ } else if (action.type === removePeerUsersActionType) {
+ const { updates } = action.payload;
+ if (updates.length === 0) {
+ return {
+ threadStore: state,
+ newThreadInconsistencies: [],
+ threadStoreOperations: [],
+ };
+ }
+
+ const { threadStoreOperations, updatedThreadStore } =
+ generateOpsAndProcessThreadUpdates(state, updates);
+ return {
+ threadStore: updatedThreadStore,
+ newThreadInconsistencies: [],
+ threadStoreOperations,
+ };
}
return {
threadStore: state,
diff --git a/lib/reducers/user-reducer.js b/lib/reducers/user-reducer.js
--- a/lib/reducers/user-reducer.js
+++ b/lib/reducers/user-reducer.js
@@ -578,10 +578,11 @@
userStoreOps,
];
} else if (action.type === removePeerUsersActionType) {
+ const userIDs = action.payload.updates.map(update => update.deletedUserID);
const userStoreOps: UserStoreOperation[] = [
{
type: 'remove_users',
- payload: { ids: action.payload.userIDs },
+ payload: { ids: userIDs },
},
];
diff --git a/lib/tunnelbroker/use-peer-to-peer-message-handler.js b/lib/tunnelbroker/use-peer-to-peer-message-handler.js
--- a/lib/tunnelbroker/use-peer-to-peer-message-handler.js
+++ b/lib/tunnelbroker/use-peer-to-peer-message-handler.js
@@ -3,6 +3,7 @@
import invariant from 'invariant';
import _isEqual from 'lodash/fp/isEqual.js';
import * as React from 'react';
+import uuid from 'uuid';
import { useResendPeerToPeerMessages } from './use-resend-peer-to-peer-messages.js';
import { removePeerUsersActionType } from '../actions/aux-user-actions.js';
@@ -36,6 +37,8 @@
userActionP2PMessageValidator,
type UserActionP2PMessage,
} from '../types/tunnelbroker/user-actions-peer-to-peer-message-types.js';
+import { updateTypes } from '../types/update-types-enum.js';
+import type { AccountDeletionUpdateInfo } from '../types/update-types.js';
import { getConfig } from '../utils/config.js';
import { getContentSigningKey } from '../utils/crypto-utils.js';
import { getMessageForException } from '../utils/errors.js';
@@ -147,9 +150,15 @@
primaryDeviceRequestedLogOut(),
);
} else {
+ const deleteUserUpdate: AccountDeletionUpdateInfo = {
+ time: Date.now(),
+ id: uuid.v4(),
+ deletedUserID: senderInfo.userID,
+ type: updateTypes.DELETE_ACCOUNT,
+ };
dispatch({
type: removePeerUsersActionType,
- payload: { userIDs: [senderInfo.userID] },
+ payload: { updates: [deleteUserUpdate] },
});
await sqliteAPI.removeInboundP2PMessages([messageID]);
}
diff --git a/lib/types/aux-user-types.js b/lib/types/aux-user-types.js
--- a/lib/types/aux-user-types.js
+++ b/lib/types/aux-user-types.js
@@ -6,6 +6,7 @@
UsersRawDeviceLists,
IdentityPlatformDetails,
} from './identity-service-types.js';
+import type { AccountDeletionUpdateInfo } from './update-types.js';
type AccountMissingFromIdentityStatus = {
+missingSince: number,
@@ -33,7 +34,9 @@
+farcasterUsers: $ReadOnlyArray<FarcasterUser>,
};
-export type RemovePeerUsersPayload = { +userIDs: $ReadOnlyArray<string> };
+export type RemovePeerUsersPayload = {
+ +updates: $ReadOnlyArray<AccountDeletionUpdateInfo>,
+};
export type SetPeerDeviceListsPayload = {
+deviceLists: UsersRawDeviceLists,

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 9:46 PM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2535924
Default Alt Text
D13740.id45244.diff (4 KB)

Event Timeline