Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3371611
D9775.id32961.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D9775.id32961.diff
View Options
diff --git a/web/database/database-module-provider.js b/web/database/database-module-provider.js
--- a/web/database/database-module-provider.js
+++ b/web/database/database-module-provider.js
@@ -131,7 +131,9 @@
}
async function getSafariEncryptionKey(): Promise<SubtleCrypto$JsonWebKey> {
- const encryptionKey = await localforage.getItem(SQLITE_ENCRYPTION_KEY);
+ const encryptionKey = await localforage.getItem<CryptoKey>(
+ SQLITE_ENCRYPTION_KEY,
+ );
if (encryptionKey) {
return await exportKeyToJWK(encryptionKey);
}
diff --git a/web/database/utils/worker-crypto-utils.js b/web/database/utils/worker-crypto-utils.js
--- a/web/database/utils/worker-crypto-utils.js
+++ b/web/database/utils/worker-crypto-utils.js
@@ -6,7 +6,7 @@
'decrypt',
];
-type EncryptedData = {
+export type EncryptedData = {
+iv: BufferSource,
+ciphertext: Uint8Array,
};
diff --git a/web/database/worker/db-worker.js b/web/database/worker/db-worker.js
--- a/web/database/worker/db-worker.js
+++ b/web/database/worker/db-worker.js
@@ -35,6 +35,7 @@
encryptDatabaseFile,
generateDatabaseCryptoKey,
importJWKKey,
+ type EncryptedData,
} from '../utils/worker-crypto-utils.js';
localforage.config(localforageConfig);
@@ -74,7 +75,9 @@
}
}
- const encryptedContent = await localforage.getItem(SQLITE_CONTENT);
+ const encryptedContent = await localforage.getItem<EncryptedData>(
+ SQLITE_CONTENT,
+ );
let dbContent = null;
try {
diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js
--- a/web/input/input-state-container.react.js
+++ b/web/input/input-state-container.react.js
@@ -232,7 +232,7 @@
}
static completedMessageIDs(state: State): Set<string> {
- const completed = new Map();
+ const completed = new Map<string, boolean>();
for (const threadID in state.pendingUploads) {
const pendingUploads = state.pendingUploads[threadID];
for (const localUploadID in pendingUploads) {
@@ -250,7 +250,7 @@
}
}
}
- const messageIDs = new Set();
+ const messageIDs = new Set<string>();
for (const [messageID, isCompleted] of completed) {
if (isCompleted) {
messageIDs.add(messageID);
@@ -265,7 +265,7 @@
return;
}
- const previouslyAssignedMessageIDs = new Set();
+ const previouslyAssignedMessageIDs = new Set<string>();
for (const threadID in prevState.pendingUploads) {
const pendingUploads = prevState.pendingUploads[threadID];
for (const localUploadID in pendingUploads) {
@@ -276,7 +276,14 @@
}
}
- const newlyAssignedUploads = new Map();
+ const newlyAssignedUploads = new Map<
+ string,
+ {
+ +threadID: string,
+ +shouldEncrypt: boolean,
+ +uploads: PendingMultimediaUpload[],
+ },
+ >();
for (const threadID in this.state.pendingUploads) {
const pendingUploads = this.state.pendingUploads[threadID];
for (const localUploadID in pendingUploads) {
@@ -306,7 +313,7 @@
}
}
- const newMessageInfos = new Map();
+ const newMessageInfos = new Map<string, RawMultimediaMessageInfo>();
for (const [messageID, assignedUploads] of newlyAssignedUploads) {
const { uploads, threadID, shouldEncrypt } = assignedUploads;
const creatorID = this.props.viewerID;
@@ -1524,7 +1531,7 @@
payload: newRawMessageInfo,
});
- const uploadIDsToRetry = new Set();
+ const uploadIDsToRetry = new Set<string>();
const uploadsToRetry = [];
for (const pendingUpload of pendingUploads) {
const { serverID, messageID, localID, abort } = pendingUpload;
@@ -1657,7 +1664,7 @@
[],
);
const textMessageCreationSideEffectsFunc =
- useMessageCreationSideEffectsFunc(messageTypes.TEXT);
+ useMessageCreationSideEffectsFunc<RawTextMessageInfo>(messageTypes.TEXT);
return (
<InputStateContainer
diff --git a/web/media/aes-crypto-utils.test.js b/web/media/aes-crypto-utils.test.js
--- a/web/media/aes-crypto-utils.test.js
+++ b/web/media/aes-crypto-utils.test.js
@@ -15,7 +15,7 @@
]);
const randomData = new Uint8Array(
- new Array(100).fill(0).map(() => Math.floor(Math.random() * 255)),
+ new Array<number>(100).fill(0).map(() => Math.floor(Math.random() * 255)),
);
describe('generateKey', () => {
diff --git a/web/modals/chat/message-results-modal.react.js b/web/modals/chat/message-results-modal.react.js
--- a/web/modals/chat/message-results-modal.react.js
+++ b/web/modals/chat/message-results-modal.react.js
@@ -89,7 +89,10 @@
// By the nature of using messageListData and passing in
// the desired translatedMessageResults as additional
// messages, we will have duplicate ChatMessageInfoItems.
- const uniqueChatMessageInfoItemsMap = new Map();
+ const uniqueChatMessageInfoItemsMap = new Map<
+ string,
+ ChatMessageInfoItem,
+ >();
chatMessageInfoItems.forEach(
item =>
item.messageInfo &&
@@ -102,8 +105,12 @@
// in the order of pin_time (newest first).
const sortedChatMessageInfoItems = [];
for (let i = 0; i < rawMessageResults.length; i++) {
+ const rawMessageID = rawMessageResults[i].id;
+ if (!rawMessageID) {
+ continue;
+ }
sortedChatMessageInfoItems.push(
- uniqueChatMessageInfoItemsMap.get(rawMessageResults[i].id),
+ uniqueChatMessageInfoItemsMap.get(rawMessageID),
);
}
diff --git a/web/roles/community-roles-modal.react.js b/web/roles/community-roles-modal.react.js
--- a/web/roles/community-roles-modal.react.js
+++ b/web/roles/community-roles-modal.react.js
@@ -5,6 +5,7 @@
import { useModalContext } from 'lib/components/modal-provider.react.js';
import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import { useRoleMemberCountsForCommunity } from 'lib/shared/thread-utils.js';
+import type { UserSurfacedPermission } from 'lib/types/thread-permission-types.js';
import type { ThreadInfo } from 'lib/types/thread-types.js';
import css from './community-roles-modal.css';
@@ -49,7 +50,10 @@
[roleNamesToMembers, threadInfo],
);
- const rolePermissionsForNewRole = React.useMemo(() => new Set(), []);
+ const rolePermissionsForNewRole = React.useMemo(
+ () => new Set<UserSurfacedPermission>(),
+ [],
+ );
const onClickCreateRole = React.useCallback(
() =>
diff --git a/web/search/message-search-state-provider.react.js b/web/search/message-search-state-provider.react.js
--- a/web/search/message-search-state-provider.react.js
+++ b/web/search/message-search-state-provider.react.js
@@ -37,7 +37,7 @@
[threadID: string]: $ReadOnlyArray<RawMessageInfo>,
}>({});
- const endsReached = React.useRef(new Set());
+ const endsReached = React.useRef(new Set<string>());
const lastIDs = React.useRef<{
[threadID: string]: string,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 5:19 AM (19 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2588432
Default Alt Text
D9775.id32961.diff (6 KB)
Attached To
Mode
D9775: [Flow202][web][skip-ci] [9/x] Fix Flow issues with types being underconstrained
Attached
Detach File
Event Timeline
Log In to Comment