Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3376408
D11190.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D11190.diff
View Options
diff --git a/lib/reducers/community-reducer.js b/lib/reducers/community-reducer.js
--- a/lib/reducers/community-reducer.js
+++ b/lib/reducers/community-reducer.js
@@ -1,5 +1,6 @@
// @flow
+import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js';
import { addCommunityActionType } from '../actions/community-actions.js';
import {
communityStoreOpsHandlers,
@@ -31,6 +32,25 @@
communityStore: processStoreOps(state, [replaceOperation]),
communityStoreOperations: [replaceOperation],
};
+ } else if (action.type === setClientDBStoreActionType) {
+ const newCommunityInfo = action.payload.communityInfos;
+
+ if (!newCommunityInfo) {
+ return {
+ communityStore: state,
+ communityStoreOperations: [],
+ };
+ }
+
+ const newCommunityStore: CommunityStore = {
+ ...state,
+ communityInfos: newCommunityInfo,
+ };
+
+ return {
+ communityStore: newCommunityStore,
+ communityStoreOperations: [],
+ };
}
return {
diff --git a/lib/reducers/message-reducer.test.js b/lib/reducers/message-reducer.test.js
--- a/lib/reducers/message-reducer.test.js
+++ b/lib/reducers/message-reducer.test.js
@@ -292,6 +292,7 @@
reports: [],
users: {},
keyserverInfos: {},
+ communityInfos: {},
},
},
{
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
@@ -1,5 +1,6 @@
// @flow
+import type { CommunityInfos } from './community-types.js';
import type {
DraftStoreOperation,
ClientDBDraftStoreOperation,
@@ -80,4 +81,5 @@
+reports: ?$ReadOnlyArray<ClientReportCreationRequest>,
+users: ?UserInfos,
+keyserverInfos: ?KeyserverInfos,
+ +communityInfos: ?CommunityInfos,
};
diff --git a/native/data/sqlite-data-handler.js b/native/data/sqlite-data-handler.js
--- a/native/data/sqlite-data-handler.js
+++ b/native/data/sqlite-data-handler.js
@@ -7,6 +7,7 @@
import { MediaCacheContext } from 'lib/components/media-cache-provider.react.js';
import { useStaffContext } from 'lib/components/staff-provider.react.js';
import { resolveKeyserverSessionInvalidation } from 'lib/keyserver-conn/recovery-utils.js';
+import { communityStoreOpsHandlers } from 'lib/ops/community-store-ops.js';
import { keyserverStoreOpsHandlers } from 'lib/ops/keyserver-store-ops.js';
import { reportStoreOpsHandlers } from 'lib/ops/report-store-ops.js';
import { threadStoreOpsHandlers } from 'lib/ops/thread-store-ops.js';
@@ -179,6 +180,7 @@
reports,
users,
keyservers,
+ communities,
} = await commCoreModule.getClientDBStore();
const threadInfosFromDB =
threadStoreOpsHandlers.translateClientDBData(threads);
@@ -187,6 +189,8 @@
const usersFromDB = userStoreOpsHandlers.translateClientDBData(users);
const keyserverInfosFromDB =
keyserverStoreOpsHandlers.translateClientDBData(keyservers);
+ const communityInfosFromDB =
+ communityStoreOpsHandlers.translateClientDBData(communities);
dispatch({
type: setClientDBStoreActionType,
@@ -199,6 +203,7 @@
reports: reportsFromDB,
users: usersFromDB,
keyserverInfos: keyserverInfosFromDB,
+ communities: communityInfosFromDB,
},
});
} catch (setStoreException) {
diff --git a/web/database/utils/store.js b/web/database/utils/store.js
--- a/web/database/utils/store.js
+++ b/web/database/utils/store.js
@@ -25,6 +25,7 @@
reports: null,
users: null,
keyserverInfos: defaultWebState.keyserverStore.keyserverInfos,
+ communityInfos: null,
};
const data = await databaseModule.schedule({
type: workerRequestMessageTypes.GET_CLIENT_STORE,
@@ -59,6 +60,14 @@
),
};
}
+ if (data?.store?.communities) {
+ result = {
+ ...result,
+ communityInfos: communityStoreOpsHandlers.translateClientDBData(
+ data.store.communities,
+ ),
+ };
+ }
return result;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 11:47 PM (21 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2592129
Default Alt Text
D11190.diff (4 KB)
Attached To
Mode
D11190: [lib/native/web] read communites from sqlite on app start
Attached
Detach File
Event Timeline
Log In to Comment