Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3373338
D10011.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10011.diff
View Options
diff --git a/native/redux/persist.js b/native/redux/persist.js
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -51,11 +51,15 @@
KeyserverStore,
KeyserverInfo,
} from 'lib/types/keyserver-types.js';
-import { messageTypes } from 'lib/types/message-types-enum.js';
+import {
+ messageTypes,
+ type MessageType,
+} from 'lib/types/message-types-enum.js';
import {
type LocalMessageInfo,
type MessageStore,
type MessageStoreThreads,
+ type RawMessageInfo,
} from 'lib/types/message-types.js';
import type {
ReportStore,
@@ -480,17 +484,19 @@
// 3. Unshim translated `RawMessageInfos` to get the TOGGLE_PIN messages
const unshimmedRawMessageInfos = rawMessageInfos.map(messageInfo =>
- unshimFunc(messageInfo, new Set([messageTypes.TOGGLE_PIN])),
+ unshimFunc(messageInfo, new Set<MessageType>([messageTypes.TOGGLE_PIN])),
);
// 4. Filter out non-TOGGLE_PIN messages
- const filteredRawMessageInfos = unshimmedRawMessageInfos.filter(
- messageInfo => messageInfo.type === messageTypes.TOGGLE_PIN,
- );
+ const filteredRawMessageInfos = unshimmedRawMessageInfos
+ .map(messageInfo =>
+ messageInfo.type === messageTypes.TOGGLE_PIN ? messageInfo : null,
+ )
+ .filter(Boolean);
// 5. We want only the last TOGGLE_PIN message for each message ID,
// so 'pin', 'unpin', 'pin' don't count as 3 pins, but only 1.
- const lastMessageIDToRawMessageInfoMap = new Map();
+ const lastMessageIDToRawMessageInfoMap = new Map<string, RawMessageInfo>();
for (const messageInfo of filteredRawMessageInfos) {
const { targetMessageID } = messageInfo;
lastMessageIDToRawMessageInfoMap.set(targetMessageID, messageInfo);
@@ -500,7 +506,7 @@
);
// 6. Create a Map of threadIDs to pinnedCount
- const threadIDsToPinnedCount = new Map();
+ const threadIDsToPinnedCount = new Map<string, number>();
for (const messageInfo of lastMessageIDToRawMessageInfos) {
const { threadID, type } = messageInfo;
if (type === messageTypes.TOGGLE_PIN) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 9:06 AM (20 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2589978
Default Alt Text
D10011.diff (2 KB)
Attached To
Mode
D10011: [Flow202][native][skip-ci] [27/x] Fix Flow issues with TOGGLE_PIN redux-persist migration
Attached
Detach File
Event Timeline
Log In to Comment