Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3696280
D9914.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D9914.diff
View Options
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
@@ -290,6 +290,7 @@
messageStoreThreads: clientDBThreads,
messages: clientDBMessages,
reports: [],
+ users: {},
},
},
{
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
@@ -3,6 +3,7 @@
import _isEqual from 'lodash/fp/isEqual.js';
import _keyBy from 'lodash/fp/keyBy.js';
+import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js';
import { siweAuthActionTypes } from '../actions/siwe-actions.js';
import {
joinThreadActionTypes,
@@ -393,6 +394,19 @@
}
: state;
return [newState, [], userStoreOps];
+ } else if (action.type === setClientDBStoreActionType) {
+ if (!action.payload.users) {
+ return [state, [], []];
+ }
+ // Once the functionality is confirmed to work correctly,
+ // we will proceed with returning the users from the payload.
+ assertUserStoresAreEqual(
+ action.payload.users ?? {},
+ state.userInfos,
+ action.type,
+ onStateDifference,
+ );
+ return [state, [], []];
}
return [state, [], []];
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -120,7 +120,7 @@
RoleDeletionPayload,
} from './thread-types.js';
import type { ClientUpdatesResultWithUserInfos } from './update-types.js';
-import type { CurrentUserInfo, UserStore } from './user-types.js';
+import type { CurrentUserInfo, UserInfos, UserStore } from './user-types.js';
import type { SetDeviceTokenActionPayload } from '../actions/device-actions.js';
import type { Shape } from '../types/core.js';
import type { NotifPermissionAlertInfo } from '../utils/push-alerts.js';
@@ -659,6 +659,7 @@
+threadStore: ?ThreadStore,
+messageStoreThreads: ?$ReadOnlyArray<ClientDBThreadMessageInfo>,
+reports: ?$ReadOnlyArray<ClientReportCreationRequest>,
+ +users: ?UserInfos,
},
}
| {
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
@@ -8,6 +8,7 @@
import { MediaCacheContext } from 'lib/components/media-cache-provider.react.js';
import { reportStoreOpsHandlers } from 'lib/ops/report-store-ops.js';
import { threadStoreOpsHandlers } from 'lib/ops/thread-store-ops.js';
+import { userStoreOpsHandlers } from 'lib/ops/user-store-ops.js';
import {
cookieSelector,
urlPrefixSelector,
@@ -168,12 +169,19 @@
mediaCacheContext?.evictCache(),
]);
try {
- const { threads, messages, drafts, messageStoreThreads, reports } =
- await commCoreModule.getClientDBStore();
+ const {
+ threads,
+ messages,
+ drafts,
+ messageStoreThreads,
+ reports,
+ users,
+ } = await commCoreModule.getClientDBStore();
const threadInfosFromDB =
threadStoreOpsHandlers.translateClientDBData(threads);
const reportsFromDb =
reportStoreOpsHandlers.translateClientDBData(reports);
+ const usersFromDb = userStoreOpsHandlers.translateClientDBData(users);
dispatch({
type: setClientDBStoreActionType,
@@ -184,6 +192,7 @@
currentUserID: currentLoggedInUserID,
messageStoreThreads,
reports: reportsFromDb,
+ users: usersFromDb,
},
});
} catch (setStoreException) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 8, 11:51 AM (2 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2817244
Default Alt Text
D9914.diff (3 KB)
Attached To
Mode
D9914: [native] read users from SQLite on app start
Attached
Detach File
Event Timeline
Log In to Comment