Hold CDSI lookup ACI & UAK args in one array

This commit is contained in:
akonradi-signal 2023-10-31 15:00:25 -04:00 committed by GitHub
parent fcf2c0a3f0
commit 87659ef2b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 33 deletions

View file

@ -15,8 +15,7 @@ export async function getServiceIdsForE164s(
// Note: these have no relationship to supplied e164s. We just provide
// all available information to the server so that it could return as many
// ACI+PNI+E164 matches as possible.
const acis = new Array<AciString>();
const accessKeys = new Array<string>();
const acisAndAccessKeys = new Array<{ aci: AciString; accessKey: string }>();
for (const convo of window.ConversationController.getAll()) {
if (!isDirectConversation(convo.attributes) || isMe(convo.attributes)) {
@ -34,8 +33,7 @@ export async function getServiceIdsForE164s(
continue;
}
acis.push(aci);
accessKeys.push(accessKey);
acisAndAccessKeys.push({ aci, accessKey });
}
const returnAcisWithoutUaks =
@ -43,13 +41,12 @@ export async function getServiceIdsForE164s(
isEnabled('desktop.cdsi.returnAcisWithoutUaks');
log.info(
`getServiceIdsForE164s(${e164s}): acis=${acis.length} ` +
`accessKeys=${accessKeys.length}`
`getServiceIdsForE164s(${e164s}): acis=${acisAndAccessKeys.length} ` +
`accessKeys=${acisAndAccessKeys.length}`
);
return server.cdsLookup({
e164s,
acis,
accessKeys,
acisAndAccessKeys,
returnAcisWithoutUaks,
});
}