Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3383623
D8616.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D8616.diff
View Options
diff --git a/lib/ops/thread-store-ops.js b/lib/ops/thread-store-ops.js
new file mode 100644
--- /dev/null
+++ b/lib/ops/thread-store-ops.js
@@ -0,0 +1,35 @@
+// @flow
+
+import type {
+ ClientDBThreadInfo,
+ RawThreadInfo,
+} from '../types/thread-types.js';
+
+export type RemoveThreadOperation = {
+ +type: 'remove',
+ +payload: { +ids: $ReadOnlyArray<string> },
+};
+
+export type RemoveAllThreadsOperation = {
+ +type: 'remove_all',
+};
+
+export type ReplaceThreadOperation = {
+ +type: 'replace',
+ +payload: { +id: string, +threadInfo: RawThreadInfo },
+};
+
+export type ThreadStoreOperation =
+ | RemoveThreadOperation
+ | RemoveAllThreadsOperation
+ | ReplaceThreadOperation;
+
+export type ClientDBReplaceThreadOperation = {
+ +type: 'replace',
+ +payload: ClientDBThreadInfo,
+};
+
+export type ClientDBThreadStoreOperation =
+ | RemoveThreadOperation
+ | RemoveAllThreadsOperation
+ | ClientDBReplaceThreadOperation;
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
@@ -25,6 +25,7 @@
registerActionTypes,
updateSubscriptionActionTypes,
} from '../actions/user-actions.js';
+import type { ThreadStoreOperation } from '../ops/thread-store-ops.js';
import type { BaseAction } from '../types/redux-types.js';
import {
type ClientThreadInconsistencyReportCreationRequest,
@@ -38,11 +39,7 @@
fullStateSyncActionType,
incrementalStateSyncActionType,
} from '../types/socket-types.js';
-import type {
- RawThreadInfo,
- ThreadStore,
- ThreadStoreOperation,
-} from '../types/thread-types.js';
+import type { RawThreadInfo, ThreadStore } from '../types/thread-types.js';
import { updateTypes } from '../types/update-types-enum.js';
import {
type ClientUpdateInfo,
diff --git a/lib/types/store-ops-types.js b/lib/types/store-ops-types.js
--- a/lib/types/store-ops-types.js
+++ b/lib/types/store-ops-types.js
@@ -11,16 +11,16 @@
MessageStoreOperation,
ClientDBThreadMessageInfo,
} from './message-types.js';
-import type {
- ClientDBThreadInfo,
- ClientDBThreadStoreOperation,
- ThreadStoreOperation,
-} from './thread-types.js';
+import type { ClientDBThreadInfo } from './thread-types.js';
import type {
ReportStoreOperation,
ClientDBReport,
ClientDBReportStoreOperation,
} from '../ops/report-store-ops.js';
+import type {
+ ClientDBThreadStoreOperation,
+ ThreadStoreOperation,
+} from '../ops/thread-store-ops.js';
export type StoreOperations = {
+draftStoreOperations: $ReadOnlyArray<DraftStoreOperation>,
diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js
--- a/lib/types/thread-types.js
+++ b/lib/types/thread-types.js
@@ -21,8 +21,8 @@
} from './subscription-types.js';
import {
type ThreadPermissionsInfo,
- type ThreadRolePermissionsBlob,
threadPermissionsInfoValidator,
+ type ThreadRolePermissionsBlob,
threadRolePermissionsBlobValidator,
} from './thread-permission-types.js';
import { type ThreadType, threadTypeValidator } from './thread-types-enum.js';
@@ -217,25 +217,6 @@
threadInfos: t.dict(tID, rawThreadInfoValidator),
});
-export type RemoveThreadOperation = {
- +type: 'remove',
- +payload: { +ids: $ReadOnlyArray<string> },
-};
-
-export type RemoveAllThreadsOperation = {
- +type: 'remove_all',
-};
-
-export type ReplaceThreadOperation = {
- +type: 'replace',
- +payload: { +id: string, +threadInfo: RawThreadInfo },
-};
-
-export type ThreadStoreOperation =
- | RemoveThreadOperation
- | RemoveAllThreadsOperation
- | ReplaceThreadOperation;
-
export type ClientDBThreadInfo = {
+id: string,
+type: number,
@@ -255,16 +236,6 @@
+pinnedCount?: number,
};
-export type ClientDBReplaceThreadOperation = {
- +type: 'replace',
- +payload: ClientDBThreadInfo,
-};
-
-export type ClientDBThreadStoreOperation =
- | RemoveThreadOperation
- | RemoveAllThreadsOperation
- | ClientDBReplaceThreadOperation;
-
export type ThreadDeletionRequest = {
+threadID: string,
+accountPassword: ?string,
diff --git a/lib/utils/thread-ops-utils.js b/lib/utils/thread-ops-utils.js
--- a/lib/utils/thread-ops-utils.js
+++ b/lib/utils/thread-ops-utils.js
@@ -1,10 +1,12 @@
// @flow
+import type {
+ ClientDBThreadStoreOperation,
+ ThreadStoreOperation,
+} from '../ops/thread-store-ops.js';
import { assertThreadType } from '../types/thread-types-enum.js';
import {
type ClientDBThreadInfo,
- type ThreadStoreOperation,
- type ClientDBThreadStoreOperation,
type RawThreadInfo,
} from '../types/thread-types.js';
diff --git a/native/redux/client-db-utils.js b/native/redux/client-db-utils.js
--- a/native/redux/client-db-utils.js
+++ b/native/redux/client-db-utils.js
@@ -1,5 +1,6 @@
// @flow
+import type { ClientDBThreadStoreOperation } from 'lib/ops/thread-store-ops.js';
import type {
ClientDBMessageStoreOperation,
RawMessageInfo,
@@ -8,7 +9,6 @@
} from 'lib/types/message-types.js';
import type {
ClientDBThreadInfo,
- ClientDBThreadStoreOperation,
RawThreadInfo,
ThreadStoreThreadInfos,
} from 'lib/types/thread-types.js';
diff --git a/native/redux/persist.js b/native/redux/persist.js
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -21,6 +21,7 @@
convertReportStoreOperationToClientDBReportStoreOperation,
convertReportsToReplaceReportOps,
} from 'lib/ops/report-store-ops.js';
+import type { ClientDBThreadStoreOperation } from 'lib/ops/thread-store-ops.js';
import { highestLocalIDSelector } from 'lib/selectors/local-id-selectors.js';
import { createAsyncMigrate } from 'lib/shared/create-async-migrate.js';
import { inconsistencyResponsesToReports } from 'lib/shared/report-utils.js';
@@ -45,10 +46,7 @@
ClientReportCreationRequest,
} from 'lib/types/report-types.js';
import { defaultConnectionInfo } from 'lib/types/socket-types.js';
-import type {
- ClientDBThreadStoreOperation,
- ClientDBThreadInfo,
-} from 'lib/types/thread-types.js';
+import type { ClientDBThreadInfo } from 'lib/types/thread-types.js';
import {
convertMessageStoreOperationsToClientDBOperations,
translateClientDBMessageInfoToRawMessageInfo,
diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js
--- a/native/redux/redux-setup.js
+++ b/native/redux/redux-setup.js
@@ -13,6 +13,7 @@
deleteAccountActionTypes,
logInActionTypes,
} from 'lib/actions/user-actions.js';
+import type { ThreadStoreOperation } from 'lib/ops/thread-store-ops.js';
import baseReducer from 'lib/reducers/master-reducer.js';
import { processThreadStoreOperations } from 'lib/reducers/thread-reducer.js';
import {
@@ -26,7 +27,6 @@
import { rehydrateActionType } from 'lib/types/redux-types.js';
import type { SetSessionPayload } from 'lib/types/session-types.js';
import { defaultConnectionInfo } from 'lib/types/socket-types.js';
-import type { ThreadStoreOperation } from 'lib/types/thread-types.js';
import { reduxLoggerMiddleware } from 'lib/utils/action-logger.js';
import { setNewSessionActionType } from 'lib/utils/action-utils.js';
import { defaultNotifPermissionAlertInfo } from 'lib/utils/push-alerts.js';
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -6,6 +6,7 @@
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport.js';
import type { ClientDBReportStoreOperation } from 'lib/ops/report-store-ops.js';
+import type { ClientDBThreadStoreOperation } from 'lib/ops/thread-store-ops.js';
import type { OLMOneTimeKeys } from 'lib/types/crypto-types';
import type { ClientDBDraftStoreOperation } from 'lib/types/draft-types.js';
import type {
@@ -13,10 +14,7 @@
ClientDBMessageStoreOperation,
} from 'lib/types/message-types.js';
import type { ClientDBStore } from 'lib/types/store-ops-types';
-import type {
- ClientDBThreadInfo,
- ClientDBThreadStoreOperation,
-} from 'lib/types/thread-types.js';
+import type { ClientDBThreadInfo } from 'lib/types/thread-types.js';
type ClientPublicKeys = {
+primaryIdentityPublicKeys: {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 5:01 PM (19 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597538
Default Alt Text
D8616.diff (7 KB)
Attached To
Mode
D8616: [lib] extract ThreadStore ops types to a separate file
Attached
Detach File
Event Timeline
Log In to Comment