Page MenuHomePhabricator

D9914.diff
No OneTemporary

D9914.diff

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

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)

Event Timeline