signal-desktop/ts/util/getProfile.ts

31 lines
725 B
TypeScript
Raw Normal View History

2023-01-03 11:55:46 -08:00
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { createLogger } from '../logging/log.js';
import { profileService } from '../services/profiles.js';
import type { ServiceIdString } from '../types/ServiceId.js';
2025-06-16 11:59:31 -07:00
const log = createLogger('getProfile');
export async function getProfile({
serviceId,
e164,
groupId,
}: {
serviceId: ServiceIdString | null;
e164: string | null;
groupId: string | null;
}): Promise<void> {
const c = window.ConversationController.lookupOrCreate({
2023-08-16 22:54:39 +02:00
serviceId,
e164,
reason: 'getProfile',
});
if (!c) {
2025-06-16 11:59:31 -07:00
log.error('failed to find conversation; doing nothing');
return;
}
return profileService.get(c.id, groupId);
}