Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3367966
D12790.id44787.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12790.id44787.diff
View Options
diff --git a/web/redux/persist.js b/web/redux/persist.js
--- a/web/redux/persist.js
+++ b/web/redux/persist.js
@@ -35,6 +35,7 @@
import { getConfig } from 'lib/utils/config.js';
import { parseCookies } from 'lib/utils/cookie-utils.js';
import { isDev } from 'lib/utils/dev-utils.js';
+import { stripMemberPermissionsFromRawThreadInfos } from 'lib/utils/member-info-utils.js';
import {
generateIDSchemaMigrationOpsForDrafts,
convertDraftStoreToNewIDSchema,
@@ -641,6 +642,45 @@
},
ops: [],
}),
+ [84]: async (state: AppState) => {
+ const sharedWorker = await getCommSharedWorker();
+ const isDatabaseSupported = await sharedWorker.isSupported();
+
+ if (!isDatabaseSupported) {
+ return {
+ state,
+ ops: [],
+ };
+ }
+
+ const stores = await sharedWorker.schedule({
+ type: workerRequestMessageTypes.GET_CLIENT_STORE,
+ });
+
+ const clientDBThreadInfos: ?$ReadOnlyArray<ClientDBThreadInfo> =
+ stores?.store?.threads;
+
+ if (
+ clientDBThreadInfos === null ||
+ clientDBThreadInfos === undefined ||
+ clientDBThreadInfos.length === 0
+ ) {
+ return {
+ state,
+ ops: [],
+ };
+ }
+
+ const dbOperations = createUpdateDBOpsForThreadStoreThreadInfos(
+ clientDBThreadInfos,
+ // We know that we're dealing with `ThinRawThreadInfoWithPermissions`
+ // at the time of this migration.
+ // $FlowFixMe
+ stripMemberPermissionsFromRawThreadInfos,
+ );
+
+ return { state, ops: dbOperations };
+ },
};
const persistConfig: PersistConfig = {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 5:35 PM (21 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585599
Default Alt Text
D12790.id44787.diff (1 KB)
Attached To
Mode
D12790: [web] Introduce `web` migration to strip member permissions
Attached
Detach File
Event Timeline
Log In to Comment