signal-desktop/ts/util/getProfile.ts

29 lines
679 B
TypeScript
Raw Normal View History

2023-01-03 19:55:46 +00:00
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as log from '../logging/log';
import { profileService } from '../services/profiles';
2023-08-16 20:54:39 +00:00
import type { ServiceIdString } from '../types/ServiceId';
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 20:54:39 +00:00
serviceId,
e164,
reason: 'getProfile',
});
if (!c) {
log.error('getProfile: failed to find conversation; doing nothing');
return;
}
return profileService.get(c.id, groupId);
}