diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js --- a/lib/reducers/master-reducer.js +++ b/lib/reducers/master-reducer.js @@ -39,7 +39,6 @@ type ReplaceKeyserverOperation, } from '../ops/keyserver-store-ops.js'; import { syncedMetadataStoreOpsHandlers } from '../ops/synced-metadata-store-ops.js'; -import { isStaff } from '../shared/staff-utils.js'; import { processDMOpsActionType } from '../types/dm-ops.js'; import type { BaseNavInfo } from '../types/nav-types.js'; import type { BaseAppState, BaseAction } from '../types/redux-types.js'; @@ -48,8 +47,6 @@ incrementalStateSyncActionType, } from '../types/socket-types.js'; import type { StoreOperations } from '../types/store-ops-types.js'; -import { getConfig } from '../utils/config.js'; -import { isDev } from '../utils/dev-utils.js'; export default function baseReducer>( state: T, @@ -71,15 +68,6 @@ entryStoreOperations, } = reduceEntryInfos(state.entryStore, action, threadInfos); - const onStateDifferenceForStaff = (message: string) => { - const isCurrentUserStaff = state.currentUserInfo?.id - ? isStaff(state.currentUserInfo.id) - : false; - if (isCurrentUserStaff || isDev) { - getConfig().showAlert('State difference found', message); - } - }; - const [userStore, newUserInconsistencies, userStoreOperations] = reduceUserInfos(state.userStore, action); @@ -216,12 +204,7 @@ ); const { threadActivityStore, threadActivityStoreOperations } = - reduceThreadActivity( - state.threadActivityStore, - action, - threadInfos, - onStateDifferenceForStaff, - ); + reduceThreadActivity(state.threadActivityStore, action, threadInfos); const { store: queuedDMOperations, operations: dmOperationStoreOperations } = reduceDMOperationsQueue(state.queuedDMOperations, action); diff --git a/lib/reducers/thread-activity-reducer.js b/lib/reducers/thread-activity-reducer.js --- a/lib/reducers/thread-activity-reducer.js +++ b/lib/reducers/thread-activity-reducer.js @@ -24,7 +24,6 @@ type ThreadActivityStoreOperation, createReplaceThreadActivityEntryOperation, } from '../ops/thread-activity-store-ops.js'; -import { isWebPlatform } from '../types/device-types.js'; import { processDMOpsActionType } from '../types/dm-ops.js'; import type { BaseAction } from '../types/redux-types.js'; import { @@ -37,34 +36,6 @@ import { updateTypes } from '../types/update-types-enum.js'; import type { ClientUpdateInfo } from '../types/update-types.js'; import { processUpdatesActionType } from '../types/update-types.js'; -import { getConfig } from '../utils/config.js'; -import { getMessageForException } from '../utils/errors.js'; -import { assertObjectsAreEqual } from '../utils/objects.js'; - -function assertThreadActivityStoresAreEqual( - processedThreadActivityStore: ThreadActivityStore, - expectedThreadActivityStore: ThreadActivityStore, - location: string, - onStateDifference?: (message: string) => mixed, -) { - try { - assertObjectsAreEqual( - processedThreadActivityStore, - expectedThreadActivityStore, - `ThreadActivityStore - ${location}`, - ); - } catch (e) { - console.log( - 'Error processing ThreadActivityStore ops', - processedThreadActivityStore, - expectedThreadActivityStore, - ); - const message = `Error processing ThreadActivityStore ops ${ - getMessageForException(e) ?? '{no exception message}' - }`; - onStateDifference?.(message); - } -} type ReduceThreadActivityResult = { +threadActivityStore: ThreadActivityStore, @@ -119,7 +90,6 @@ state: ThreadActivityStore, action: BaseAction, threadInfos: RawThreadInfos, - onStateDifference?: (message: string) => mixed, ): ReduceThreadActivityResult { if (action.type === updateThreadLastNavigatedActionType) { const { threadID, time } = action.payload; @@ -227,37 +197,24 @@ threadActivityStoreOperations: [removeOperation], }; } else if (action.type === setClientDBStoreActionType) { - if (!isWebPlatform(getConfig().platformDetails.platform)) { - assertThreadActivityStoresAreEqual( - action.payload.threadActivityStore ?? {}, - state, - action.type, - onStateDifference, - ); + const newThreadActivityStore = action.payload.threadActivityStore; + + if (!newThreadActivityStore) { return { threadActivityStore: state, threadActivityStoreOperations: [], }; - } else { - const newThreadActivityStore = action.payload.threadActivityStore; - - if (!newThreadActivityStore) { - return { - threadActivityStore: state, - threadActivityStoreOperations: [], - }; - } + } - const threadActivityStore: ThreadActivityStore = { - ...state, - ...newThreadActivityStore, - }; + const threadActivityStore: ThreadActivityStore = { + ...state, + ...newThreadActivityStore, + }; - return { - threadActivityStore, - threadActivityStoreOperations: [], - }; - } + return { + threadActivityStore, + threadActivityStoreOperations: [], + }; } else if (action.type === processDMOpsActionType) { return handleThreadDeletionUpdates(state, action.payload.updateInfos); }