2023-01-03 11:55:46 -08:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
2021-07-21 16:45:41 -04:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2021-09-17 14:27:53 -04:00
|
|
|
import * as log from '../logging/log';
|
2022-07-13 17:46:46 -07:00
|
|
|
import { profileService } from '../services/profiles';
|
2023-08-16 22:54:39 +02:00
|
|
|
import type { ServiceIdString } from '../types/ServiceId';
|
2022-03-09 12:23:21 -08:00
|
|
|
|
2024-10-10 10:57:22 -07:00
|
|
|
export async function getProfile({
|
|
|
|
serviceId,
|
|
|
|
e164,
|
|
|
|
groupId,
|
|
|
|
}: {
|
|
|
|
serviceId: ServiceIdString | null;
|
|
|
|
e164: string | null;
|
|
|
|
groupId: string | null;
|
|
|
|
}): Promise<void> {
|
2022-08-09 14:39:00 -07:00
|
|
|
const c = window.ConversationController.lookupOrCreate({
|
2023-08-16 22:54:39 +02:00
|
|
|
serviceId,
|
2022-08-09 14:39:00 -07:00
|
|
|
e164,
|
2022-12-02 18:05:27 -07:00
|
|
|
reason: 'getProfile',
|
2022-03-09 12:23:21 -08:00
|
|
|
});
|
|
|
|
if (!c) {
|
|
|
|
log.error('getProfile: failed to find conversation; doing nothing');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-10-10 10:57:22 -07:00
|
|
|
return profileService.get(c.id, groupId);
|
2022-03-09 12:23:21 -08:00
|
|
|
}
|