storageRecordOps.toRecipient: Allow for missing recipients

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
automated-signal
2026-02-04 14:34:09 -06:00
committed by GitHub
parent 8f81f08934
commit e0fb7526de

View File

@@ -853,11 +853,14 @@ export function toDefunctOrPendingCallLinkRecord(
function toRecipient(
conversationId: string,
logPrefix: string
): Proto.Recipient {
): Proto.Recipient | undefined {
const conversation = window.ConversationController.get(conversationId);
if (conversation == null) {
throw new Error(`${logPrefix}/toRecipient: Missing conversation`);
log.error(
`${logPrefix}/toRecipient: Missing conversation with id ${conversationId}`
);
return undefined;
}
const logId = `${logPrefix}/toRecipient(${conversation.idForLogging()})`;
@@ -903,9 +906,11 @@ function toRecipients(
conversationIds: ReadonlyArray<string>,
logPrefix: string
): Array<Proto.Recipient> {
return conversationIds.map(conversationId => {
return toRecipient(conversationId, logPrefix);
});
return conversationIds
.map(conversationId => {
return toRecipient(conversationId, logPrefix);
})
.filter(isNotNil);
}
function toChatFolderRecordFolderType(