signal-desktop/ts/util/startConversation.ts

25 lines
623 B
TypeScript
Raw Normal View History

// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ServiceIdString } from '../types/ServiceId';
import { strictAssert } from './assert';
2023-08-16 20:54:39 +00:00
export function startConversation(
e164: string,
serviceId: ServiceIdString
): void {
const conversation = window.ConversationController.lookupOrCreate({
e164,
2023-08-16 20:54:39 +00:00
serviceId,
reason: 'util/startConversation',
});
strictAssert(
conversation,
2023-08-16 20:54:39 +00:00
`startConversation failed given ${e164}/${serviceId} combination`
);
window.reduxActions.conversations.showConversation({
conversationId: conversation.id,
});
}